{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "sys.path.append('../scripts/')\n",
    "from mcl import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "class ResetMcl(Mcl): ###ermcl  sensor_reset_mclから改造\n",
    "    def __init__(self, envmap, init_pose, num, motion_noise_stds={\"nn\":0.19, \"no\":0.001, \"on\":0.13, \"oo\":0.2}, \\\n",
    "                 distance_dev_rate=0.14, direction_dev=0.05, alpha_threshold=0.001, expansion_rate=0.2): #膨張の大きさのパラメータを追加\n",
    "        super().__init__(envmap, init_pose, num, motion_noise_stds, distance_dev_rate, direction_dev)\n",
    "        self.alpha_threshold = alpha_threshold\n",
    "        self.expansion_rate = expansion_rate\n",
    "        \n",
    "    def random_reset(self):\n",
    "         for p in self.particles:\n",
    "                p.pose = np.array([np.random.uniform(-5.0, 5.0), np.random.uniform(-5.0, 5.0), np.random.uniform(-math.pi, math.pi)]).T\n",
    "                p.weight = 1/len(self.particles)\n",
    "                \n",
    "    def sensor_resetting_draw(self, particle, landmark_pos, ell_obs, phi_obs):\n",
    "            ##パーティクルの位置を決める##\n",
    "            psi = np.random.uniform(-np.pi, np.pi) #ランドマークからの方角を選ぶ\n",
    "            ell = norm(loc=ell_obs, scale=(ell_obs*self.distance_dev_rate)**2).rvs() #ランドマークからの距離を選ぶ\n",
    "            particle.pose[0] = landmark_pos[0] + ell*math.cos(psi)\n",
    "            particle.pose[1] = landmark_pos[1] + ell*math.sin(psi)\n",
    "            \n",
    "            ##パーティクルの向きを決める##\n",
    "            phi = norm(loc=phi_obs, scale=(self.direction_dev)**2).rvs() #ランドマークが見える向きを決める\n",
    "            particle.pose[2] = math.atan2(landmark_pos[1]- particle.pose[1], landmark_pos[0]- particle.pose[0]) - phi\n",
    "            \n",
    "            particle.weight = 1.0/len(self.particles) #重みを1/Nに\n",
    "            \n",
    "    def sensor_resetting(self, observation):\n",
    "        nearest_obs = np.argmin([obs[0][0] for obs in observation]) #距離が一番近いランドマークを選択\n",
    "        values, landmark_id = observation[nearest_obs]\n",
    "        \n",
    "        for p in self.particles:\n",
    "            self.sensor_resetting_draw(p, self.map.landmarks[landmark_id].pos, *values)\n",
    "            \n",
    "    def expansion_resetting(self): #以下追加\n",
    "        for p in self.particles:\n",
    "            p.pose += multivariate_normal(cov=np.eye(3)*(self.expansion_rate**2)).rvs()\n",
    "            p.weight = 1.0/len(self.particles)\n",
    "        \n",
    "    def observation_update(self, observation):        \n",
    "        for p in self.particles:\n",
    "            p.observation_update(observation, self.map, self.distance_dev_rate, self.direction_dev) \n",
    "            \n",
    "        self.set_ml()\n",
    "\n",
    "        if sum([p.weight for p in self.particles]) < self.alpha_threshold: \n",
    "            self.expansion_resetting() #expansion_resettingに変更\n",
    "        else:\n",
    "            self.resampling() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "def trial(animation): ###mclkidnap1test\n",
    "    time_interval = 0.1\n",
    "    world = World(30, time_interval, debug=not animation) \n",
    "\n",
    "    ## 地図を生成して3つランドマークを追加 ##\n",
    "    m = Map()\n",
    "    m.append_landmark(Landmark(-4,2))\n",
    "    m.append_landmark(Landmark(2,-3))\n",
    "    m.append_landmark(Landmark(3,3))\n",
    "    world.append(m)\n",
    "\n",
    "    ## ロボットを作る ##\n",
    "    init_pose = np.array([np.random.uniform(-5.0, 5.0), np.random.uniform(-5.0, 5.0), np.random.uniform(-math.pi, math.pi)]).T\n",
    "    robot_pose = np.array([np.random.uniform(-5.0, 5.0), np.random.uniform(-5.0, 5.0), np.random.uniform(-math.pi, math.pi)]).T\n",
    "    pf = ResetMcl(m, init_pose, 100)\n",
    "    a = EstimationAgent(time_interval, 0.2, 10.0/180*math.pi, pf)\n",
    "    r = Robot(robot_pose, sensor=Camera(m), agent=a, color=\"red\")\n",
    "    world.append(r)\n",
    "\n",
    "    world.draw()\n",
    "    return (r.pose, pf.ml.pose)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "def trial_phantom(animation): ###mclkidnap1test\n",
    "    time_interval = 0.1\n",
    "    world = World(30, time_interval, debug=not animation) \n",
    "\n",
    "    ## 地図を生成して3つランドマークを追加 ##\n",
    "    m = Map()\n",
    "    m.append_landmark(Landmark(-4,2))\n",
    "    m.append_landmark(Landmark(2,-3))\n",
    "    m.append_landmark(Landmark(3,3))\n",
    "    world.append(m)\n",
    "\n",
    "    ## ロボットを作る ##\n",
    "    init_pose = np.array([np.random.uniform(-5.0, 5.0), np.random.uniform(-5.0, 5.0), np.random.uniform(-math.pi, math.pi)]).T\n",
    "    robot_pose = np.array([0,0,0]).T #np.array([np.random.uniform(-5.0, 5.0), np.random.uniform(-5.0, 5.0), np.random.uniform(-math.pi, math.pi)]).T\n",
    "    pf = ResetMcl(m, init_pose, 100)\n",
    "    a = EstimationAgent(time_interval, 0.2, 10.0/180*math.pi, pf)\n",
    "    r = Robot(robot_pose, sensor=Camera(m, phantom_prob=0.1), agent=a, color=\"red\")\n",
    "    world.append(r)\n",
    "\n",
    "    world.draw()\n",
    "    \n",
    "    return (r.pose, pf.ml.pose)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 真値: [ 1.64510358 -4.15325735  6.05426631] 推定値 [-4.30111863 -1.81553408  5.98215674] 誤差: 6.389249453966047\n",
      "1 真値: [-3.69186036 -1.13885171  4.30454663] 推定値 [ 0.51969267 -1.3905209   5.18772232] 誤差: 4.2190658055170305\n",
      "2 真値: [2.0464869  2.12370439 4.2711373 ] 推定値 [1.49170953 2.79831608 4.30199143] 誤差: 0.8734293700181998\n",
      "3 真値: [ 6.42483121 -2.01033798  1.35824368] 推定値 [-1.82796902 -2.76053379  4.66671322] 誤差: 8.286827212597418\n",
      "4 真値: [1.24052171 0.24174858 4.48853563] 推定値 [1.85899606 0.47712633 4.33889861] 誤差: 0.6617501071831574\n",
      "5 真値: [-3.06968806  3.26895311  4.40731628] 推定値 [-2.74109721  2.68660618  3.91684696] 誤差: 0.6686552825309524\n",
      "6 真値: [-1.36075207  1.83976592  6.81454094] 推定値 [-1.71473359  1.03899993  6.88791381] 誤差: 0.8755164667484446\n",
      "7 真値: [3.65711893 2.25741978 2.41481999] 推定値 [3.94553236 2.61995649 2.8566196 ] 誤差: 0.46326576925096385\n",
      "8 真値: [2.36922778 3.96814754 2.72537361] 推定値 [0.17656985 1.54553511 1.84495038] 誤差: 3.267537266807573\n",
      "9 真値: [-0.46810129 -2.1319215   4.18962109] 推定値 [-2.64675584  5.47027768  3.83409717] 誤差: 7.908221544989052\n",
      "10 真値: [3.60054341 1.51220981 3.18533283] 推定値 [1.95873582 1.80287476 1.88073189] 誤差: 1.667338686172248\n",
      "11 真値: [-3.84610047  1.03925546  6.43505108] 推定値 [ 0.48331422 -1.00002454  4.87423225] 誤差: 4.78565507217075\n",
      "12 真値: [-0.53971069 -0.26416217  7.4338766 ] 推定値 [-0.59913538 -0.28429734  7.40774892] 誤差: 0.06274327820157441\n",
      "13 真値: [ 0.37933682 -1.18483223  8.41765047] 推定値 [ 2.12338704 -0.06558507  8.70804987] 誤差: 2.0722995438146725\n",
      "14 真値: [-4.78733408 -1.03458064  3.92337082] 推定値 [-2.91930593 -0.60988311  4.68488488] 誤差: 1.915697568494633\n",
      "15 真値: [0.27461419 3.21482518 4.33201606] 推定値 [1.13258678 2.21714639 4.12147516] 誤差: 1.3158571080999082\n",
      "16 真値: [-4.04586281  0.56222845  6.75698689] 推定値 [-4.00176662 -5.74921904  7.14316491] 誤差: 6.311601531250641\n",
      "17 真値: [-1.96418021  2.32671288  3.65787925] 推定値 [-1.11605824 -0.13098768  2.86856449] 誤差: 2.599923631870968\n",
      "18 真値: [3.57644257 2.92327475 4.88725205] 推定値 [2.99821536 3.67859895 6.43738352] 誤差: 0.9512420026571784\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.7/site-packages/matplotlib/pyplot.py:514: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).\n",
      "  max_open_warning, RuntimeWarning)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "19 真値: [-0.9855602   2.86671692  7.13587508] 推定値 [0.31627387 1.76000573 7.58749391] 誤差: 1.7086783248907063\n",
      "20 真値: [ 3.53196368 -4.35576052  6.02987325] 推定値 [-2.70153456  6.54012797  1.8803363 ] 誤差: 12.552963236884453\n",
      "21 真値: [ 1.16328896 -2.14845686  7.05136718] 推定値 [ 1.23175307 -2.2073665   6.99830632] 誤差: 0.09031987606546019\n",
      "22 真値: [ 3.50166818 -1.59037463  2.72081453] 推定値 [-1.30630049  6.24102975  6.59968805] 誤差: 9.189529767505038\n",
      "23 真値: [-2.43432801 -1.55604907  2.43070587] 推定値 [-2.52945731 -1.01472903  2.56412387] 誤差: 0.5496152876707693\n",
      "24 真値: [-5.11774039 -2.03065439  6.30575923] 推定値 [-6.60733526 -2.06859883 -0.31078879] 誤差: 1.4900780643784546\n",
      "25 真値: [-0.47819383 -1.9021438   5.88003572] 推定値 [-0.04215829 -2.40979743  5.97876327] 誤差: 0.6692078896026455\n",
      "26 真値: [-3.84485833  4.21191938  4.16735021] 推定値 [-3.53082798 -1.08591028  7.51984325] 誤差: 5.307128613371909\n",
      "27 真値: [ 0.43805588 -4.45712     2.56302078] 推定値 [ 0.1869409  -2.92545265  1.82030833] 誤差: 1.5521158387352019\n",
      "28 真値: [-3.51665309  3.91560007  7.46834426] 推定値 [-3.38822861  0.31643713  4.75704669] 誤差: 3.6014534205710045\n",
      "29 真値: [-1.75612223  1.02837278  5.75711882] 推定値 [-2.92609554  0.35496582 12.15767043] 誤差: 1.3499312834282047\n",
      "30 真値: [-1.93299771 -1.97505108  6.50122192] 推定値 [-0.28023126  0.77607982  5.72532031] 誤差: 3.2094171078065195\n",
      "31 真値: [-0.26954154  4.47431568  4.48295651] 推定値 [0.4111202  4.09495779 4.29519786] 誤差: 0.7792386226516074\n",
      "32 真値: [1.40546642 2.71314489 3.60161149] 推定値 [ 0.42909679 -2.03611756  8.92240512] 誤差: 4.848586545320986\n",
      "33 真値: [ 2.17910588 -3.80865654  2.34054256] 推定値 [ 1.87460355 -2.09870228  5.40024814] 誤差: 1.7368549871690389\n",
      "34 真値: [ 1.59414682 -2.77574122  3.25172966] 推定値 [-2.54830974  0.3763669   3.65862616] 誤差: 5.205356084188373\n",
      "35 真値: [-3.32223616  3.11522761  3.31475512] 推定値 [ 1.55578098 -1.02808157  2.70110196] 誤差: 6.4001610960931465\n",
      "36 真値: [-0.08123689  0.1577843   3.05837277] 推定値 [-0.0765047  -0.54101143  2.98445424] 誤差: 0.698811747721184\n",
      "37 真値: [-1.23860248  4.36406945  3.85980243] 推定値 [-1.5949824  -0.12113945  2.43717466] 誤差: 4.499345014641336\n",
      "38 真値: [-0.66543954 -1.86241523  8.01319319] 推定値 [-10.14932015   3.17894465   5.47237858] 誤差: 10.740544720256347\n",
      "39 真値: [ 0.19513852 -4.3441395   7.5356147 ] 推定値 [-1.09934225 -4.55476803  7.29618878] 誤差: 1.311504805732805\n",
      "40 真値: [2.62208087 0.69157866 8.43994772] 推定値 [2.16268481 0.74763409 8.21399375] 誤差: 0.4628033629669489\n",
      "41 真値: [1.90851425 0.16903643 1.84021141] 推定値 [ 1.58550169 -0.00295824  1.83138168] 誤差: 0.36594983124112096\n",
      "42 真値: [ 1.80227804 -0.92523952  5.50175038] 推定値 [-1.04476033  5.67432436  5.79449374] 誤差: 7.187480146853267\n",
      "43 真値: [1.88347142 2.97336369 6.31094649] 推定値 [ 2.62757851 -3.08689748  1.11163966] 誤差: 6.105772745522989\n",
      "44 真値: [3.65334016 3.27523784 4.06876055] 推定値 [2.23039612 3.20137567 6.59050004] 誤差: 1.4248597740093552\n",
      "45 真値: [-3.67397711  1.15342317  3.62837601] 推定値 [-3.34584742  1.3313494  10.42159711] 誤差: 0.3732650986874599\n",
      "46 真値: [-4.37669633 -2.83424297  8.62193164] 推定値 [-0.98581864 -0.35797682  3.34818695] 誤差: 4.198802871820424\n",
      "47 真値: [-3.33349434 -0.83240045  7.05345992] 推定値 [-3.12911875  4.59292683  3.27677832] 誤差: 5.429175404638131\n",
      "48 真値: [-7.11223005  1.57493412  4.95391947] 推定値 [-1.65556667 -4.15948233  4.0543341 ] 誤差: 7.915725321394997\n",
      "49 真値: [-3.11440733 -0.20146081  7.8224442 ] 推定値 [-2.18516473 -1.46447456  1.6742047 ] 誤差: 1.5680228134749399\n",
      "50 真値: [ 0.38419392 -0.38828961  3.10132221] 推定値 [ 0.63780486 -0.36978975  3.03752146] 誤差: 0.25428479637448137\n",
      "51 真値: [5.10155194 2.34578775 2.67358443] 推定値 [ 1.03733222 -0.17427566  7.09965152] 誤差: 4.782112667316553\n",
      "52 真値: [6.14867052 2.49830144 7.30649501] 推定値 [-1.05908103  1.82662506  2.59684321] 誤差: 7.238980002768084\n",
      "53 真値: [ 2.25173821 -0.23214371  6.34471263] 推定値 [ 1.57716656 -0.30589343  6.61008195] 誤差: 0.6785911340206034\n",
      "54 真値: [-2.41037944 -2.74204639  8.45728065] 推定値 [2.82360066 1.17570107 3.22484848] 誤差: 6.537835480419491\n",
      "55 真値: [-2.48334984  0.70001532  7.58587794] 推定値 [-1.22110798  0.86775609  1.34338211] 誤差: 1.273338708216528\n",
      "56 真値: [-5.24877376  2.66027572  6.11559985] 推定値 [-3.39603562  0.48213071  2.20759563] 誤差: 2.8595374305986248\n",
      "57 真値: [3.68163834 1.44335324 8.46840914] 推定値 [ 0.14460229 -4.38650747  1.71200072] 誤差: 6.818936855661746\n",
      "58 真値: [1.16138073 2.73263322 6.04727192] 推定値 [0.76840041 4.72196985 5.12930334] 誤差: 2.0277804953874563\n",
      "59 真値: [-3.07752282 -0.61227714  6.97462013] 推定値 [ 1.17318849  2.37349138 12.18004421] 誤差: 5.194551018513398\n",
      "60 真値: [ 7.3299025  -0.47752914  2.21357032] 推定値 [ 6.42656536 -0.53906558  8.30457764] 誤差: 0.9054306820558612\n",
      "61 真値: [3.26516382 3.64780543 7.00740752] 推定値 [3.42055647 2.4238908  4.72487778] 誤差: 1.2337398025498336\n",
      "62 真値: [ 1.60855902 -3.73682046  4.71020653] 推定値 [ 2.21895988 -3.92519921  5.57941728] 誤差: 0.6388080715399748\n",
      "63 真値: [-5.01412092  3.4214182   3.96043135] 推定値 [ 3.3076109  -2.93620175  4.76266751] 誤差: 10.472370885408063\n",
      "64 真値: [-0.97273917 -4.83245582  6.36637948] 推定値 [-1.12053116 -5.44827752  6.46310623] 誤差: 0.6333078574633134\n",
      "65 真値: [0.68163792 3.57707369 3.4755098 ] 推定値 [0.44884911 3.63157962 3.5748325 ] 誤差: 0.2390847719689842\n",
      "66 真値: [4.17418794 3.66147389 3.9065649 ] 推定値 [2.37922319 1.63731096 7.66925857] 誤差: 2.7053898056260626\n",
      "67 真値: [-2.54221309 -3.09736264  4.11774659] 推定値 [-2.42908857 -2.88702646  4.20018642] 誤差: 0.23882727469101653\n",
      "68 真値: [-5.55189913  4.23259769  5.58452372] 推定値 [-1.54045139  1.75834649  3.32093249] 誤差: 4.71313398476823\n",
      "69 真値: [ 2.07767588 -3.42083109  6.45201327] 推定値 [ 1.38427817 -3.31718604  5.51658683] 誤差: 0.7011010513035457\n",
      "70 真値: [1.21434786 2.73291802 5.09083175] 推定値 [2.48951546 1.73204187 4.82920728] 誤差: 1.621050735017772\n",
      "71 真値: [ 4.43327427 -4.6095286   9.3328844 ] 推定値 [ 0.47489853 -5.0647492   7.70297764] 誤差: 3.9844653672908237\n",
      "72 真値: [ 4.54495404 -5.41937558  1.61861587] 推定値 [-6.54585402 -3.58215391 -0.74865969] 誤差: 11.24194853478722\n",
      "73 真値: [2.22423836 3.83710067 4.63118352] 推定値 [ 2.85944483 -1.62205933  7.33335978] 誤差: 5.49599082041733\n",
      "74 真値: [ 3.67775813 -3.65178427  7.7322325 ] 推定値 [1.4616671  4.33414799 3.94998903] 誤差: 8.287712201150725\n",
      "75 真値: [ 5.15017567 -4.19304379  7.71878873] 推定値 [-0.82974192  0.43485424  3.79217961] 誤差: 7.56153784116038\n",
      "76 真値: [-1.60087581  1.13881074  5.05527066] 推定値 [-1.6544368   1.11771203  5.05477045] 誤差: 0.05756679087262306\n",
      "77 真値: [-1.39042043  4.17047115  6.40499939] 推定値 [ 0.30408046 -0.08224304  7.48628691] 誤差: 4.577871916701296\n",
      "78 真値: [-1.10719687  1.8940958   6.6878467 ] 推定値 [6.75963777 0.09430088 2.60629841] 誤差: 8.070089782251245\n",
      "79 真値: [-0.96187604  0.42762314  3.90223262] 推定値 [-0.86336343  0.44383435 10.00969739] 誤差: 0.09983755780620877\n",
      "80 真値: [-3.40187235 -4.29663451  9.28872738] 推定値 [1.80709096 2.46797993 7.41770561] 誤差: 8.537757741182373\n",
      "81 真値: [-2.21666056 -0.77736989  6.72769768] 推定値 [-1.49576022 -0.59682553  0.28362432] 誤差: 0.7431645661581794\n",
      "82 真値: [0.73935225 2.68293009 5.39618533] 推定値 [2.15642508 2.28225402 5.57005946] 誤差: 1.4726291878094107\n",
      "83 真値: [1.40462747 3.32776668 5.28343052] 推定値 [-2.93532308  4.63397135  5.80983635] 誤差: 4.532255659585446\n",
      "84 真値: [ 0.32989587 -1.44654877  5.57527644] 推定値 [ 0.63733914 -1.41538464 -0.91497664] 誤差: 0.3090187080085123\n",
      "85 真値: [-2.44094005 -3.14424064  6.27331171] 推定値 [-1.63468397 -1.54388555  5.75086253] 誤差: 1.791978034907066\n",
      "86 真値: [0.04697759 3.73660732 4.32266702] 推定値 [ 0.12581398  2.95437184 10.44514034] 誤差: 0.7861981478809991\n",
      "87 真値: [5.7018625  4.98139628 2.58477305] 推定値 [ 6.21460356 -4.26612812  9.25196697] 誤差: 9.261728295041188\n",
      "88 真値: [0.75237331 5.1695539  3.86084864] 推定値 [1.10376612 4.76534266 3.68529103] 誤差: 0.5355965219507214\n",
      "89 真値: [-5.48694133 -4.69755456  6.5028932 ] 推定値 [3.39759983 2.13897118 8.41465159] 誤差: 11.21040390962386\n",
      "90 真値: [0.41048052 1.59391818 8.06491404] 推定値 [0.81693408 1.50403533 8.1043925 ] 誤差: 0.41627324804351473\n",
      "91 真値: [ 1.49220915 -1.34410427  2.52837536] 推定値 [ 1.31860085 -2.19479517 -3.80054392] 誤差: 0.8682251109591289\n",
      "92 真値: [-2.64312691 -0.45873359  6.87222614] 推定値 [-0.46874063  0.72188106  6.29687213] 誤差: 2.4742284977720086\n",
      "93 真値: [4.41090873 0.49874438 6.54495781] 推定値 [-2.17298729 -0.79766095  8.60940998] 誤差: 6.710316944250548\n",
      "94 真値: [1.96490867 3.6317937  7.46211745] 推定値 [-2.80626088 -8.64503965  6.64447771] 誤差: 13.17135892717138\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "95 真値: [0.68509365 2.5052762  2.16221123] 推定値 [1.25074125 2.33923635 2.1937712 ] 誤差: 0.5895137358528355\n",
      "96 真値: [-2.32640056 -5.00945115  8.31376038] 推定値 [-2.21808956 -1.44156692  7.60864263] 誤差: 3.569527858790033\n",
      "97 真値: [-0.87679707 -3.4772742   7.96725401] 推定値 [-1.33427618 -3.41195684  1.47098475] 誤差: 0.4621184858283972\n",
      "98 真値: [-1.7086236  -5.54629124  7.13620942] 推定値 [ 2.37403248  1.27327763 11.09136702] 誤差: 7.948245101042549\n",
      "99 真値: [-1.63337684 -2.24911761  3.30120157] 推定値 [ 1.3038108  -0.52894029 10.18411204] 誤差: 3.403833317457381\n",
      "100 真値: [-2.92664437  4.85312482  6.28705829] 推定値 [-0.86137874 -0.24941073 10.81538319] 誤差: 5.504651775520259\n",
      "101 真値: [-0.5508072  -1.03967752  3.50577221] 推定値 [0.04620969 4.62676383 4.82717247] 誤差: 5.697805424687749\n",
      "102 真値: [ 0.7023852  -4.76556736  1.49077835] 推定値 [-0.71742324 -2.45398356  6.62221693] 誤差: 2.712798492355456\n",
      "103 真値: [-2.21663229 -5.83319921  6.96205691] 推定値 [-0.16857717  3.39622104  5.06700942] 誤差: 9.453926590679039\n",
      "104 真値: [-4.73869416  1.67571679  7.00475742] 推定値 [-3.37706998  2.53991423  4.08980992] 誤差: 1.6127174593011937\n",
      "105 真値: [0.43452018 0.80012079 3.81471399] 推定値 [-0.12734743  1.01190505  3.82864767] 誤差: 0.600456310502065\n",
      "106 真値: [ 1.7199539  -0.63777327  5.77583051] 推定値 [-0.02473763 -2.04881987  6.72691465] 誤差: 2.2438808049413224\n",
      "107 真値: [-0.39606519 -3.46062555  5.4300477 ] 推定値 [ 0.7852593  -4.09678257 11.9172879 ] 誤差: 1.3417239963830407\n",
      "108 真値: [ 2.11223341 -3.29691869  5.80235474] 推定値 [-2.76417491  2.61640087 11.89005688] 誤差: 7.664639995500842\n",
      "109 真値: [4.09645213 0.41975768 6.92061008] 推定値 [-1.48015817  0.25059856  2.58432767] 誤差: 5.579175322792629\n",
      "110 真値: [-2.45191399 -0.30981919  5.06463777] 推定値 [-2.77950121 -0.5078544   5.14548812] 誤差: 0.38279411364543975\n",
      "111 真値: [ 5.41113937 -1.33712614  7.55246853] 推定値 [ 6.26864197 -2.71307508  7.52314401] 誤差: 1.6212791770919752\n",
      "112 真値: [ 0.35767374 -1.58245511  4.41375865] 推定値 [-2.57345939  1.07499448  3.77982041] 誤差: 3.9564605042328234\n",
      "113 真値: [-5.2458986  -1.49351293  6.99097531] 推定値 [-6.28620223 -1.5593742   6.72232281] 誤差: 1.04238637044169\n",
      "114 真値: [-2.36908488 -3.02437608  5.03830324] 推定値 [-1.45331561 -2.35049244  5.04383162] 誤差: 1.136992756530877\n",
      "115 真値: [1.69240798 1.71662852 6.06352182] 推定値 [0.66252357 0.43165635 6.09595691] 誤差: 1.6467590516390986\n",
      "116 真値: [ 1.15653646 -5.93457203  6.41018692] 推定値 [ 3.2775927  -1.29654441  3.36382796] 誤差: 5.100017624443567\n",
      "117 真値: [2.03276058 4.06173698 8.16030886] 推定値 [1.48000128 2.07406571 9.83339404] 誤差: 2.063099586546793\n",
      "118 真値: [-3.0672649  -4.85249484  6.49451267] 推定値 [-3.46169472 -4.90914564  6.37986082] 誤差: 0.39847735022848935\n",
      "119 真値: [-3.0374726   4.09620448  3.96512545] 推定値 [ 5.59904146 -2.6303257   2.4931385 ] 誤差: 10.94694401914746\n",
      "120 真値: [2.60510092 4.53982798 2.86111829] 推定値 [1.40175858 3.20261302 9.87226751] 誤差: 1.7989376439940872\n",
      "121 真値: [-4.48682001 -4.50417333  5.49225729] 推定値 [2.84408069 2.7790411  6.96672159] 誤差: 10.333794927040344\n",
      "122 真値: [2.41449087 4.00337246 5.50238183] 推定値 [3.815636   2.33743633 8.97907451] 誤差: 2.1768212792300368\n",
      "123 真値: [-2.33595337 -6.4408128   6.10652423] 推定値 [-5.46196324 -0.78993536  5.163119  ] 誤差: 6.457890798686934\n",
      "124 真値: [-2.45089376 -1.84328753  5.87794019] 推定値 [ 0.77476975 -6.77931738  7.46677438] 誤差: 5.8965494841943\n",
      "125 真値: [1.13701872 2.17759739 7.00081275] 推定値 [4.08435887 0.57645774 2.28200331] 誤差: 3.3541708640031835\n",
      "126 真値: [-1.66813608 -3.98196132  8.96797209] 推定値 [-1.42527205 -3.81399915  2.08922082] 誤差: 0.29528668898465843\n",
      "127 真値: [ 3.33313142 -4.41661146  6.64580777] 推定値 [ 3.32297218 -4.67421094  6.58973336] 誤差: 0.2577997354069824\n",
      "128 真値: [ 2.42756044 -4.67485138  7.02570673] 推定値 [-1.93901176 -3.44228809  5.63140376] 誤差: 4.5371979242926725\n",
      "129 真値: [-2.45733226 -2.63388617  4.1964333 ] 推定値 [-0.27505327 -1.6852066   4.81505695] 誤差: 2.379566037487432\n",
      "130 真値: [4.96011179 1.91655457 8.61218938] 推定値 [4.20944439 1.30553035 8.18826248] 誤差: 0.9679112216221413\n",
      "131 真値: [-5.12810823  0.85715827  6.63070924] 推定値 [-2.2090757   0.65405977  2.00007357] 誤差: 2.9260895184837534\n",
      "132 真値: [ 2.5872441  -3.98564457  8.12853055] 推定値 [ 0.88702417 -2.43952179  5.53744568] 誤差: 2.2980956211205377\n",
      "133 真値: [2.60792266 1.87001695 4.69119213] 推定値 [2.66902168 3.59993851 4.6346585 ] 誤差: 1.7310002106029645\n",
      "134 真値: [4.81393442 0.27554233 3.86410115] 推定値 [-0.72270088  0.28784406 10.97929029] 誤差: 5.536648968868197\n",
      "135 真値: [3.21619725 2.14663872 7.1195351 ] 推定値 [3.45591939 1.89921724 7.25491943] 誤差: 0.34450557829897477\n",
      "136 真値: [ 4.5367082  -4.87795848  7.84892899] 推定値 [ 4.4885628  -0.4331262   3.00212788] 誤差: 4.445093022531279\n",
      "137 真値: [-4.83152985  2.95389976  4.67414323] 推定値 [-5.0492032   2.76597918  4.86121159] 誤差: 0.28756882257757405\n",
      "138 真値: [-3.33068147  0.66807089  4.79137342] 推定値 [-2.68803037  0.51554248  5.4304142 ] 誤差: 0.6605038545513193\n",
      "139 真値: [ 3.67725133 -4.41999303  6.4475822 ] 推定値 [ 3.40251024 -1.67884416  7.92248689] 誤差: 2.754882900207867\n",
      "140 真値: [-3.6023135   0.30653325  6.70369409] 推定値 [-1.54545962 -2.00067857  5.07659962] 誤差: 3.0909341996824757\n",
      "141 真値: [-1.00846835  3.66687433  2.2828793 ] 推定値 [-0.05599009  0.01987191  9.91072296] 誤差: 3.7693290507321215\n",
      "142 真値: [0.29433238 2.70635921 4.33125376] 推定値 [-2.44245425 -3.57716944  2.96627818] 誤差: 6.853665688174865\n",
      "143 真値: [ 1.15677047 -2.6271211   7.64986976] 推定値 [ 2.33852955 -2.1925033   7.39398556] 誤差: 1.2591454066279453\n",
      "144 真値: [-1.03466262 -3.29349458  7.9793431 ] 推定値 [1.54229162e+00 9.56160926e-01 6.69248428e-04] 誤差: 4.969936119879806\n",
      "145 真値: [-4.24171632  4.22139835  6.32179073] 推定値 [0.30793274 2.22943057 4.73439797] 誤差: 4.966612744564519\n",
      "146 真値: [-0.55687749  3.38626936  2.7651467 ] 推定値 [-0.85168523  5.09030366  9.41740847] 誤差: 1.7293479979944488\n",
      "147 真値: [ 4.45818836 -5.51808142  6.87946952] 推定値 [ 5.45241305 -4.07330132  7.56295977] 誤差: 1.753816485510987\n",
      "148 真値: [-2.00387817  2.0080749   5.81750864] 推定値 [-2.06041946  1.81283436  5.82341376] 誤差: 0.20326285634236763\n",
      "149 真値: [-0.20952039 -0.02691992  3.99032133] 推定値 [-0.15450134  0.44233032  3.94328363] 誤差: 0.4724646970526769\n",
      "150 真値: [4.48113277 4.2056453  2.07661962] 推定値 [ 7.53790395 -2.91023029  8.00327697] 誤差: 7.744645598378057\n",
      "151 真値: [1.15383011 1.48317694 4.8704369 ] 推定値 [-2.13294731 -2.47553919  6.10735033] 誤差: 5.145322074573513\n",
      "152 真値: [-1.04248367  4.28086417  8.22907911] 推定値 [-1.85258391  2.54162882  2.22021179] 誤差: 1.918645881828001\n",
      "153 真値: [ 1.29453344 -3.97985317  8.00571489] 推定値 [ 0.63056363 -2.48471252  6.61398407] 誤差: 1.6359405465169485\n",
      "154 真値: [-1.03403093  2.9390035   4.42888386] 推定値 [-1.62759939  1.04493239  3.83553194] 誤差: 1.9849002171118237\n",
      "155 真値: [ 0.22797676 -3.30427071  2.95106482] 推定値 [ 3.30629003 -1.04455136  7.15970948] 誤差: 3.81868356182002\n",
      "156 真値: [1.54603698 0.36747117 5.6756909 ] 推定値 [2.32074635 0.35742806 5.45759151] 誤差: 0.7747744670839308\n",
      "157 真値: [1.63656554 4.64971663 3.63528264] 推定値 [4.52094027 3.697753   7.80206031] 誤差: 3.0374088149641363\n",
      "158 真値: [-0.62117825 -1.49805516  5.98426272] 推定値 [-0.20280752 -0.95618199  5.81073602] 誤差: 0.6845879041454791\n",
      "159 真値: [-2.66716405 -5.61269615  7.08525069] 推定値 [ 5.83646118 -5.44517477  2.92638682] 誤差: 8.50527515644558\n",
      "160 真値: [-3.83890418  1.54759413  3.35627302] 推定値 [-3.90019563  2.42988854  5.84570942] 誤差: 0.8844207509007193\n",
      "161 真値: [-3.34325282 -3.6245039   4.08663211] 推定値 [ 6.9419699  -0.37259916  1.03093353] 誤差: 10.787061268835224\n",
      "162 真値: [-2.80224874 -5.77048261  7.39330852] 推定値 [0.94325995 3.09153535 5.51172502] 誤差: 9.62102892911497\n",
      "163 真値: [3.02271748 3.88348861 5.97356068] 推定値 [2.2102099  3.27381686 7.13491912] 誤差: 1.0158091423484215\n",
      "164 真値: [-1.50145908  5.63340642  3.44188085] 推定値 [0.39306781 7.52649584 3.29460371] 誤差: 2.678249365811399\n",
      "165 真値: [-4.36260583 -1.53543416  8.72151471] 推定値 [0.46896399 5.03852235 4.73149201] 誤差: 8.158490734217944\n",
      "166 真値: [-3.26841581 -0.85606714  6.30508913] 推定値 [-0.90889386  1.93444292  5.62301899] 誤差: 3.654352233937588\n",
      "167 真値: [4.74187087 0.78355022 2.45607729] 推定値 [1.10483908 0.53676075 1.08256899] 誤差: 3.645395080137902\n",
      "168 真値: [-0.53017991  0.25838975  6.75272952] 推定値 [-1.06431994  0.67874877  6.56174823] 誤差: 0.6797111686825679\n",
      "169 真値: [-3.28851475 -2.26165104  6.37065344] 推定値 [-2.77911371 -2.20188013  6.39645544] 誤差: 0.5128956791369385\n",
      "170 真値: [-1.91202972 -3.21833443  5.17113129] 推定値 [0.61365487 0.535909   6.46606094] 誤差: 4.524757049092591\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "171 真値: [-2.90507665 -0.11209146  4.39981918] 推定値 [-1.05102388  1.32019361  5.37924062] 誤差: 2.342851295935612\n",
      "172 真値: [ 1.08793834 -3.86628325  7.15689524] 推定値 [ 1.28105578 -4.35686913  7.49666872] 誤差: 0.5272275122979633\n",
      "173 真値: [ 4.59517782 -0.39027036  8.66693887] 推定値 [ 1.4821416  -1.13703855  7.8205417 ] 誤差: 3.201352409061604\n",
      "174 真値: [-1.0977896   2.71906754  3.57559074] 推定値 [-0.93605959  2.75416637  3.53377007] 誤差: 0.16549477620136718\n",
      "175 真値: [ 1.55029367 -1.2566646   2.66458814] 推定値 [-1.95919963  0.60306683  1.70764647] 誤差: 3.9717935687208037\n",
      "176 真値: [-1.98362309 -1.15602036  3.84820391] 推定値 [-2.36619689 -1.06729701  4.12922088] 誤差: 0.3927270639165885\n",
      "177 真値: [ 2.43632928 -4.39319861  7.39084645] 推定値 [-3.56003232  3.77177225  5.21640776] 誤差: 10.130306091886577\n",
      "178 真値: [-0.88027789  4.51418356  5.96999599] 推定値 [-1.00748972  4.59471723  5.93484482] 誤差: 0.1505606882469881\n",
      "179 真値: [ 2.98180755 -0.09570958  3.50732334] 推定値 [0.83472106 0.77275578 4.10080946] 誤差: 2.3160769586056578\n",
      "180 真値: [ 1.15129882 -3.92489998  5.0896945 ] 推定値 [-1.79487255  6.1906297   3.41825602] 誤差: 10.535837248355445\n",
      "181 真値: [-0.01455419  4.62159848  5.73122356] 推定値 [-1.82817496  0.86802343  0.27295979] 誤差: 4.168758323048629\n",
      "182 真値: [-2.94235566 -3.6347344   4.71354614] 推定値 [-0.27905398 -2.15569309 11.77863456] 誤差: 3.046430546394556\n",
      "183 真値: [5.48602074 4.01217092 1.74332296] 推定値 [-4.46426689 -2.35435293  4.01945973] 誤差: 11.812741000649417\n",
      "184 真値: [ 2.6352753  -3.62297389  8.21060935] 推定値 [-3.61971477  1.07558515  5.10726447] 誤差: 7.823129670122813\n",
      "185 真値: [ 5.15640175 -2.63969048  8.10015864] 推定値 [ 2.7350613  -5.67817741  6.98752635] 誤差: 3.885266071778867\n",
      "186 真値: [-4.35207076 -1.02087866  3.40415779] 推定値 [-2.03114365 -1.13383369  4.30877933] 誤差: 2.3236741338346962\n",
      "187 真値: [2.47791079 3.2883879  8.206215  ] 推定値 [2.28237836 3.06469342 8.90381467] 誤差: 0.2971062923441247\n",
      "188 真値: [-1.73059754  3.48987911  5.23196594] 推定値 [-2.02629206  3.74360744  5.07580924] 誤差: 0.3896322805043363\n",
      "189 真値: [2.46341329 3.19268637 5.18013097] 推定値 [-0.7643997  -2.06159892  6.38490978] 誤差: 6.166546078749008\n",
      "190 真値: [-0.09247196  3.3748036   7.3735717 ] 推定値 [-0.04597498  1.96847611  7.80687234] 誤差: 1.407095942010873\n",
      "191 真値: [ 0.67774674 -0.90486218  6.78913125] 推定値 [ 1.29211049 -0.99516206  7.00296347] 誤差: 0.6209644728917076\n",
      "192 真値: [-3.86702153  0.36887173  4.04214175] 推定値 [-2.38225106  1.28074679  5.06229204] 誤差: 1.742429186927778\n",
      "193 真値: [0.78858863 2.55995927 7.24942355] 推定値 [0.47632199 2.71113077 7.15182686] 誤差: 0.3469341078877339\n",
      "194 真値: [-3.18820878 -0.13227994  3.92766064] 推定値 [-1.95737162  0.1262016   4.35432719] 誤差: 1.257685499699965\n",
      "195 真値: [-0.05531167  3.68665178  6.38063338] 推定値 [-0.4026113   4.01075338  6.30437046] 誤差: 0.47503566153502846\n",
      "196 真値: [ 2.26480602 -1.48673615  8.35779366] 推定値 [-0.51006563  0.12983277  7.61993666] 誤差: 3.211418339888081\n",
      "197 真値: [0.44309262 4.9741355  4.11627111] 推定値 [-8.45000765 -0.38449759  0.88447867] 誤差: 10.382782914786162\n",
      "198 真値: [-0.63034179  2.77767946  5.04182447] 推定値 [0.00628678 1.59829957 5.08901203] 誤差: 1.3402361277502532\n",
      "199 真値: [ 1.90249966 -3.19038829  7.46128246] 推定値 [ 2.1726542  -3.00683954  9.19033046] 誤差: 0.3266092794229028\n",
      "200 真値: [-5.69733599  1.20261139  6.27474638] 推定値 [-1.33281129  1.61756194  2.52559686] 誤差: 4.38420571926211\n",
      "201 真値: [-2.03509511 -2.13626805  7.20831442] 推定値 [0.77291188 0.77414397 6.13186999] 誤差: 4.044181171755006\n",
      "202 真値: [4.57884252 3.45678533 4.63579853] 推定値 [1.1141669  2.1000099  7.89264883] 誤差: 3.7208623621486225\n",
      "203 真値: [ 0.25292933 -1.36999253  6.21220251] 推定値 [ 0.73762012 -0.74168258  5.8612741 ] 誤差: 0.7935354771528645\n",
      "204 真値: [0.0254257  3.51914647 9.71698598] 推定値 [2.1065624  0.85987722 2.90656731] 誤差: 3.3768095785344956\n",
      "205 真値: [-3.9464759  -0.70254936  3.40289073] 推定値 [-1.38312807 -2.12684899  3.66715868] 誤差: 2.9324702185575693\n",
      "206 真値: [-3.30181895  5.78173381  3.92132084] 推定値 [-2.55775736  5.01119891  9.91869436] 誤差: 1.0711450319076372\n",
      "207 真値: [0.23847724 2.57923459 6.59711789] 推定値 [0.26038705 0.57703119 7.16800703] 誤差: 2.0023232737157564\n",
      "208 真値: [3.10848652 5.4575253  4.04811779] 推定値 [2.99117388 5.45546677 4.12841762] 誤差: 0.11733070308146963\n",
      "209 真値: [1.11084689 1.47535719 6.79296371] 推定値 [1.69449988 1.39207744 6.97192244] 誤差: 0.5895645287563248\n",
      "210 真値: [2.1730098  3.14764268 8.10271929] 推定値 [2.06885941 2.99098127 1.98632153] 誤差: 0.1881225606421925\n",
      "211 真値: [-4.93104201 -3.58116749  7.78449938] 推定値 [1.2700123  0.55015834 2.96424278] 誤差: 7.451236647374889\n",
      "212 真値: [ 1.53478317 -2.71379079  7.73382787] 推定値 [ 2.4387416  -3.32129119  2.37012143] 誤差: 1.089126985450816\n",
      "213 真値: [ 3.89195462 -0.38727002  2.4097296 ] 推定値 [ 3.91140819 -0.84995572  8.67624374] 誤差: 0.4630944824931232\n",
      "214 真値: [1.97896144 0.54627373 4.07220696] 推定値 [1.27626197 0.25894989 4.20268955] 誤差: 0.7591716112855371\n",
      "215 真値: [4.12417321 4.58348641 5.83498819] 推定値 [-0.12137099  1.7394698   8.41303285] 誤差: 5.110095495202256\n",
      "216 真値: [-1.2820623   2.554002    3.71970556] 推定値 [-1.00706367  1.89242769  9.76132402] 誤差: 0.716452933298836\n",
      "217 真値: [ 3.0384569 -0.7337923  3.5383097] 推定値 [ 1.48532273 -0.46717901 10.43977526] 誤差: 1.5758516505657523\n",
      "218 真値: [-3.00840679  2.59005579  6.03670209] 推定値 [-3.76053292  1.18874302 -2.41104008] 誤差: 1.590399689773242\n",
      "219 真値: [1.9171879  3.33326476 6.15834355] 推定値 [3.29384734 2.00977546 2.04929008] 誤差: 1.9096636285217337\n",
      "220 真値: [ 2.56271307 -1.17891621  5.72781595] 推定値 [0.48845946 3.71663285 3.26522311] 誤差: 5.316853263366377\n",
      "221 真値: [1.19655237 1.14961423 8.13614989] 推定値 [1.57261921 1.21730917 8.22041484] 誤差: 0.38211107258752264\n",
      "222 真値: [-0.52917449  5.28255617  3.92654313] 推定値 [-0.52519415  5.17548273  3.83671459] 誤差: 0.10714739906970616\n",
      "223 真値: [2.19384363 2.01786211 1.14797976] 推定値 [2.17617556 1.22888739 7.76818904] 誤差: 0.7891725268340547\n",
      "224 真値: [ 0.18675612 -4.3026953   7.22371683] 推定値 [-0.51631032 -4.36415073  7.04173194] 誤差: 0.7057472587867187\n",
      "225 真値: [-0.93521391 -4.16873125  7.99472735] 推定値 [-0.99377892 -3.61335645  1.63829061] 誤差: 0.5584541378009155\n",
      "226 真値: [ 3.55725467 -4.7645334   1.98106534] 推定値 [ 4.2644598  -3.17197179  2.72201765] 誤差: 1.7425244846000147\n",
      "227 真値: [-4.05982799 -0.81699896  6.6823971 ] 推定値 [-2.10075575  4.8643493   8.91257339] 誤差: 6.009632442072121\n",
      "228 真値: [3.32201059 1.21657618 7.80780201] 推定値 [3.55214051 1.09262161 7.90873192] 誤差: 0.26138958664882184\n",
      "229 真値: [0.99971416 4.33870722 8.81098782] 推定値 [1.50126087 4.97778409 2.13691663] 誤差: 0.8123843626829148\n",
      "230 真値: [-4.91925     1.44678534  4.24238563] 推定値 [-4.74850325  0.85311582  4.88458391] 誤差: 0.6177361515776946\n",
      "231 真値: [-4.037622    4.76840046  3.69463323] 推定値 [6.20358667 7.50622973 8.70201943] 誤差: 10.600852052402374\n",
      "232 真値: [0.04934418 1.23095522 3.74079797] 推定値 [-0.18144926  1.59174754 10.10366906] 誤差: 0.42829512140148235\n",
      "233 真値: [2.16812245 0.14304567 8.41216266] 推定値 [ 1.83398064 -0.27269082  8.34017126] 誤差: 0.533373762089455\n",
      "234 真値: [ 3.96714844 -0.28242688  5.27036661] 推定値 [ 2.6174022  -5.74245296  2.84017607] 誤差: 5.62438438062948\n",
      "235 真値: [-0.88636481  2.82405068  7.91599096] 推定値 [6.23480975 0.09100535 4.11072194] 誤差: 7.627625053493961\n",
      "236 真値: [-1.29355729 -1.97106069  8.04413157] 推定値 [-0.85450337 -2.52846445  8.02492266] 誤差: 0.7095542998307115\n",
      "237 真値: [-4.39248521e+00  4.10632720e-04  6.74644053e+00] 推定値 [ 4.57962112 -3.25858709  6.40278975] 誤差: 9.545666977685517\n",
      "238 真値: [-1.68561623 -0.55494174  7.43298107] 推定値 [-1.7120333  -0.63763684  7.42620788] 誤差: 0.08681210350360252\n",
      "239 真値: [-2.73684991  0.75870457  9.22801133] 推定値 [-1.470181    2.90954996 10.36896887] 誤差: 2.4961141851108604\n",
      "240 真値: [ 3.09461832 -5.53170422  6.58780955] 推定値 [2.46493673 7.1694821  2.80444663] 誤差: 12.716785475915794\n",
      "241 真値: [3.84785769 2.18456297 4.25746643] 推定値 [ 2.22798837  1.68693041 10.06461898] 誤差: 1.6945839598430161\n",
      "242 真値: [5.63992158e-01 8.29621833e-04 5.88864482e+00] 推定値 [ 0.17714836 -0.20396056  5.99771878] 誤差: 0.43770668585057215\n",
      "243 真値: [-4.70365761 -5.96803666  6.87896758] 推定値 [ 4.26427048 -6.14932335  7.56379471] 誤差: 8.969760261049426\n",
      "244 真値: [-2.84600082 -2.26294911  7.79893188] 推定値 [-2.16063125 -1.5870283   7.87934397] 誤差: 0.9626008377294778\n",
      "245 真値: [-3.89985041 -3.13794238  6.69974221] 推定値 [ 6.06100112 -0.22255724 10.41718974] 誤差: 10.378729872472071\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "246 真値: [-5.46750147  1.33605627  5.69127712] 推定値 [ 4.29231029 -4.87152745  7.03375165] 誤差: 11.566677189652541\n",
      "247 真値: [-3.60922507  2.13429549  5.16607024] 推定値 [-3.58961883  2.04546857  5.31337979] 誤差: 0.0909649752356727\n",
      "248 真値: [-1.19903616 -1.48523379  5.05836341] 推定値 [-1.49822099 -2.23348046  5.30157897] 誤差: 0.805844054233754\n",
      "249 真値: [0.96305541 5.04194524 5.09251453] 推定値 [-0.56056097  0.36992716  6.54009861] 誤差: 4.914179466363796\n",
      "250 真値: [-2.78385931  4.30136113  3.76459654] 推定値 [-1.88989376  2.70868911  3.07769163] 誤差: 1.8264113883145219\n",
      "251 真値: [ 0.22705878 -5.00237734  3.14986   ] 推定値 [ 4.7782053  -3.73401831  4.54377778] 誤差: 4.724581392637144\n",
      "252 真値: [ 7.22168206 -1.49217983  1.39149373] 推定値 [-2.54424682 -0.94216543  4.59701905] 誤差: 9.781404942267866\n",
      "253 真値: [ 1.18417126 -1.61760332  5.14755215] 推定値 [-6.43302759 -3.32750271  0.0872837 ] 誤差: 7.806758236437969\n",
      "254 真値: [-1.66942617 -4.24534551  5.97760749] 推定値 [ 5.43295219 -1.16589029  0.43236752] 誤差: 7.741241683444025\n",
      "255 真値: [-1.44106869  2.97644696  3.58714339] 推定値 [-1.36388453  2.74863279  3.42717363] 誤差: 0.24053417421420645\n",
      "256 真値: [-5.47413313  0.96951898  5.37383894] 推定値 [-1.4133962   2.08426559  5.37084094] 誤差: 4.210967159367222\n",
      "257 真値: [-0.71120152 -2.25586138  2.27814232] 推定値 [-0.01792244 -0.49325103  8.95240772] 誤差: 1.8940515135920335\n",
      "258 真値: [1.77196818 3.74758547 5.7799024 ] 推定値 [2.30290922 0.90107954 7.62513869] 誤差: 2.8955991409551216\n",
      "259 真値: [3.66784582 1.42818209 2.50223754] 推定値 [2.38768046 1.51721783 1.62168714] 誤差: 1.283257851266966\n",
      "260 真値: [ 6.35887206 -0.17238436  2.69086027] 推定値 [-1.56331011 -1.75365361  7.42308831] 誤差: 8.078451755272951\n",
      "261 真値: [-6.16037601  4.46527917  4.98744639] 推定値 [-1.52104577  0.06550199  1.98530397] 誤差: 6.393858324420504\n",
      "262 真値: [-1.59678864 -1.73622129  5.24393103] 推定値 [-1.36070955 -1.04906846  5.05045815] 誤差: 0.7265757703818944\n",
      "263 真値: [0.17559442 4.29870601 2.19444829] 推定値 [ 3.29885758 -0.12794281  4.72824551] 誤差: 5.4175633356608435\n",
      "264 真値: [ 0.74276664 -3.07017431  2.98792954] 推定値 [ 1.3263543  -1.97986883  8.3594547 ] 誤差: 1.236665113205515\n",
      "265 真値: [2.18840339 0.68977619 3.00110703] 推定値 [5.06621478 3.10716792 5.00809004] 誤差: 3.7584014088228574\n",
      "266 真値: [-4.81988852 -2.39497394  4.10638486] 推定値 [ 0.11106553  0.71724469 12.3045113 ] 誤差: 5.830970123235126\n",
      "267 真値: [2.68434251 1.77588496 7.66688803] 推定値 [2.40999145 1.8632694  7.3559463 ] 誤差: 0.2879314937954147\n",
      "268 真値: [-2.68157189 -2.12915564  4.39072613] 推定値 [-2.26583735 -1.84365973  4.82239571] 誤差: 0.5043244254720677\n",
      "269 真値: [-0.99781122  4.01593452  6.3622106 ] 推定値 [-1.00012126  3.24373097  6.58531407] 誤差: 0.7722070090119046\n",
      "270 真値: [ 2.90763927 -0.21760468  6.65957092] 推定値 [2.49344079 0.16001984 0.73097725] 誤差: 0.5605003574518941\n",
      "271 真値: [-2.19409241  4.31744469  3.59599354] 推定値 [ 4.508525   -1.61273915  8.35739546] 誤差: 8.949422362167532\n",
      "272 真値: [-3.92006038  0.5689663   1.98745705] 推定値 [-4.39567381 -0.22922519  8.05018307] 誤差: 0.9291489540757342\n",
      "273 真値: [0.10754347 3.5724203  2.51072616] 推定値 [-6.99306782 -1.16160923  6.04857533] 誤差: 8.53403282928018\n",
      "274 真値: [6.36091433 1.47002143 2.15422855] 推定値 [-0.67623394 -0.76284943  6.54138964] 誤差: 7.382896995968141\n",
      "275 真値: [5.05159699 3.25209268 3.89434786] 推定値 [ 1.58317963 -3.15078532  8.30040911] 誤差: 7.281947934537145\n",
      "276 真値: [ 1.37436114 -3.42052071  7.12246564] 推定値 [ 1.4325482  -2.70301171 -0.33256507] 誤差: 0.7198644986284565\n",
      "277 真値: [-2.96509485  0.97535464  8.47847701] 推定値 [1.21144317 2.24056298 9.04262453] 誤差: 4.36396860422361\n",
      "278 真値: [-2.08398685 -3.05926045  3.75103801] 推定値 [ 3.09209333 -0.73898353  8.37887559] 誤差: 5.672344409594481\n",
      "279 真値: [ 1.33673408 -3.83157811  6.69962398] 推定値 [-4.99999725 -2.3587344   5.66849779] 誤差: 6.505646202448913\n",
      "280 真値: [ 0.53792695 -3.90367151  4.36230053] 推定値 [ 1.69409362 -1.31345354  8.40115517] 誤差: 2.836538472621329\n",
      "281 真値: [-0.50162005 -2.61873606  5.23990252] 推定値 [-0.54153207 -2.23126355  5.18373951] 誤差: 0.3895226801766555\n",
      "282 真値: [ 3.16529055 -0.68175642  7.56966421] 推定値 [ 2.21594843 -1.1372164   1.05370725] 誤差: 1.052945504237189\n",
      "283 真値: [-2.06579515  4.09974078  2.65129896] 推定値 [-3.82593744  2.79565911  2.87757794] 誤差: 2.190600348631837\n",
      "284 真値: [ 0.76923182 -2.70851738  4.70962188] 推定値 [-3.15555276 -1.3139129   3.96597315] 誤差: 4.165195754172952\n",
      "285 真値: [0.46204077 3.29999392 3.62244214] 推定値 [1.11889969 2.99742051 3.59119091] 誤差: 0.723197280553081\n",
      "286 真値: [ 4.55833105 -3.97316186  4.74493588] 推定値 [ 3.30156168 -5.01261732  3.6513938 ] 誤差: 1.6309312975699528\n",
      "287 真値: [ 2.52253195 -0.78601776  4.12556361] 推定値 [ 1.6728792  -0.60777285  4.51656198] 誤差: 0.8681480489543246\n",
      "288 真値: [-3.08167412  4.16556943  7.91092946] 推定値 [-3.8130104  -0.09279301  4.84831258] 誤差: 4.320706356279881\n",
      "289 真値: [-2.22907242 -3.26979267  2.46743751] 推定値 [2.10135155 1.75065361 8.99018238] 誤差: 6.630041678321338\n",
      "290 真値: [3.52872198 5.49423248 3.91075956] 推定値 [0.20990426 2.87103027 5.67675408] 誤差: 4.230335796791735\n",
      "291 真値: [ 5.45948625 -2.3081592   3.8263245 ] 推定値 [-1.55691334 -2.6132296   6.5977564 ] 誤差: 7.02302863133504\n",
      "292 真値: [0.99753579 1.14880455 3.73988665] 推定値 [1.2813005  0.81920599 3.60483034] 誤差: 0.4349225431424717\n",
      "293 真値: [ 2.2810255  -5.99692074  7.542598  ] 推定値 [-1.29071324  1.74704763  4.95516292] 誤差: 8.527975353831915\n",
      "294 真値: [3.68806665 2.08999697 8.55439806] 推定値 [ 4.73589185 -7.37599046  8.06498815] 誤差: 9.523804678724503\n",
      "295 真値: [-2.21014748 -4.13013959  2.41590724] 推定値 [-2.1068169  -0.18188165  8.12692458] 誤差: 3.9496098534693487\n",
      "296 真値: [ 2.40967557 -2.45120085  5.25446568] 推定値 [ 1.93929513 -2.3074069   6.0347387 ] 誤差: 0.4918683335768819\n",
      "297 真値: [-5.08425898 -0.99096167  5.7113984 ] 推定値 [-7.35113204  0.56435107  4.89082744] 誤差: 2.7491291672008593\n",
      "298 真値: [-2.66584384  3.65621277  4.29457591] 推定値 [-2.5851238   3.75972375  4.32518227] 誤差: 0.13126403627403055\n",
      "299 真値: [ 2.50597592 -0.88931589  1.5954021 ] 推定値 [ 2.12486001 -1.00063258  1.47753031] 誤差: 0.3970399809696301\n",
      "300 真値: [1.93794403 1.18456135 3.90681162] 推定値 [1.95686244 1.39025759 3.91332469] 誤差: 0.20656438856432585\n",
      "301 真値: [ 1.34625351 -2.00003062  4.59300896] 推定値 [ 0.25744812 -3.12063935  5.59601411] 誤差: 1.562453557253302\n",
      "302 真値: [3.20015874 2.14896413 4.82697291] 推定値 [3.42729648 1.47467533 4.80365651] 誤差: 0.7115173592733167\n",
      "303 真値: [-3.72576459  2.11556963  6.92408894] 推定値 [ 5.19946415 -0.55531903  5.81933766] 誤差: 9.316295096463167\n",
      "304 真値: [1.74750761 0.23959099 5.35702743] 推定値 [-1.34095358 -3.98272991  7.16016003] 誤差: 5.2313082873754695\n",
      "305 真値: [ 3.67679893 -3.53968889  3.52212855] 推定値 [-0.95753149  1.6602407   5.66367774] 誤差: 6.965363325045942\n",
      "306 真値: [-0.97379906  1.25298438  7.30182327] 推定値 [-1.7081783   2.71679151  7.00868913] 誤差: 1.6376947814720713\n",
      "307 真値: [-3.38784675 -1.12428978  3.2132095 ] 推定値 [-3.14583554 -1.38124885  9.45410852] 誤差: 0.3529835583177936\n",
      "308 真値: [-3.21000324 -3.27324951  6.7823508 ] 推定値 [-1.56923172  0.3528464   5.9873877 ] 誤差: 3.9800380369464547\n",
      "309 真値: [-3.15078475 -2.64467985  6.06973293] 推定値 [-1.25761314 -0.95244809  5.54471236] 誤差: 2.539241436056236\n",
      "310 真値: [0.86571353 2.24250139 6.07413596] 推定値 [-0.54699904 -6.6440322   1.44019897] 誤差: 8.99812402882445\n",
      "311 真値: [-3.4702663   6.430778    4.27993719] 推定値 [-0.68528972 -2.38792466  8.04535627] 誤差: 9.248005796062477\n",
      "312 真値: [ 4.37955585 -2.96319934  6.88662772] 推定値 [ 3.79653942 -2.01278217  7.16963228] 誤差: 1.1149892177378162\n",
      "313 真値: [3.95838222 2.18896729 6.63877904] 推定値 [0.41461424 1.65118145 7.15272127] 誤差: 3.5843416630627023\n",
      "314 真値: [ 4.36521878 -3.52755178  2.10879606] 推定値 [-4.97060942 -0.23772822  5.23546257] 誤差: 9.898516413878863\n",
      "315 真値: [-4.09828691  1.02909663  6.39353633] 推定値 [-2.19082823  1.95571662  3.31544742] 誤差: 2.120618596447712\n",
      "316 真値: [-2.29954218  2.39449671  5.58891712] 推定値 [-2.54958177  1.26375814  5.76699179] 誤差: 1.1580541930251982\n",
      "317 真値: [-0.15861551  3.95654213  3.29092488] 推定値 [-0.57743165  5.3788693   9.82491025] 誤差: 1.482707498050165\n",
      "318 真値: [-2.8345739   0.36175049  4.8806154 ] 推定値 [-2.94775881  0.05150137  4.89492137] 誤差: 0.33025042091876283\n",
      "319 真値: [-3.08601944  5.87543067  3.66674166] 推定値 [-2.8627006   5.91611689  3.57035998] 誤差: 0.22699487053868583\n",
      "320 真値: [ 3.20983635 -1.79850197  7.23329771] 推定値 [ 3.38289814 -1.57744261  7.32297674] 誤差: 0.2807447583008764\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "321 真値: [3.29816755 1.85800496 6.91583145] 推定値 [0.61018598 1.4557021  1.24848256] 誤差: 2.71792063117796\n",
      "322 真値: [-1.33640988  1.441918    6.98962306] 推定値 [-1.22405896  1.65918478  6.87973   ] 誤差: 0.2445967733708086\n",
      "323 真値: [ 2.14967755 -2.31916977  3.93186768] 推定値 [ 1.47478949 -2.74089358  5.12682182] 誤差: 0.79581710664976\n",
      "324 真値: [ 0.48131858 -4.09783243  6.59591508] 推定値 [ 2.68782993 -1.25329456 10.31166636] 誤差: 3.6000122217473667\n",
      "325 真値: [-3.50407799 -4.46430036  5.67611103] 推定値 [-2.17614076 -0.79947007  4.90386198] 誤差: 3.8979992680200923\n",
      "326 真値: [ 0.73706578 -2.08537967  6.46413642] 推定値 [ 0.53742481 -1.74692177  0.07341099] 誤差: 0.3929507228046302\n",
      "327 真値: [3.17451662 3.64346911 8.22266233] 推定値 [-3.1468742  -1.34683491 10.46356148] 誤差: 8.053764096970074\n",
      "328 真値: [ 1.21931777 -1.68969134  5.23762039] 推定値 [ 1.10473972 -2.30766274  5.55042099] 誤差: 0.6285036070721284\n",
      "329 真値: [-0.72674482  0.39033537  5.09548407] 推定値 [-3.18430134 -0.83193892 11.90635664] 誤差: 2.7447292225074658\n",
      "330 真値: [ 1.80019932 -4.52928011  5.95570074] 推定値 [-6.09947724  1.77332598 11.79270034] 誤差: 10.105826697394134\n",
      "331 真値: [2.57692276 2.70904937 5.07211533] 推定値 [-3.19002238 -2.90785383  0.41264995] 誤差: 8.050295503805748\n",
      "332 真値: [-5.97226861 -6.55552236  5.97940121] 推定値 [ 3.38079452 -0.82347444  6.72751944] 誤差: 10.96978410866984\n",
      "333 真値: [2.83650943 4.931697   5.23806846] 推定値 [0.9071765  1.24458601 7.48005784] 誤差: 4.161383541250984\n",
      "334 真値: [1.42267197 2.02733353 4.26360067] 推定値 [1.44870264 2.45911533 4.21562328] 誤差: 0.4325657426792751\n",
      "335 真値: [-2.17813237 -0.34942623  8.50685374] 推定値 [0.49032145 1.5492721  9.33066489] 誤差: 3.275011628506246\n",
      "336 真値: [-0.14854846  5.12723639  4.4742469 ] 推定値 [2.04767743 4.69154464 4.09298507] 誤差: 2.2390255546535616\n",
      "337 真値: [ 5.35013309 -2.12656402  2.05489295] 推定値 [-0.13124999 -1.96792521  6.7638822 ] 誤差: 5.48367821459617\n",
      "338 真値: [-4.02732681  5.94460216  4.32169429] 推定値 [-0.05616905  0.69319839  8.61999013] 誤差: 6.583869343354088\n",
      "339 真値: [-2.13137608 -2.69008872  7.17050856] 推定値 [5.37793292 0.14189808 4.83578228] 誤差: 8.025576042948586\n",
      "340 真値: [-1.49670668 -3.69915459  5.10085763] 推定値 [ 2.73288068 -3.52822729 10.83570401] 誤差: 4.233039726245439\n",
      "341 真値: [-0.24185732  2.8878112   4.81679039] 推定値 [-0.19990926 -3.45280709  3.56573455] 誤差: 6.340757049863218\n",
      "342 真値: [-2.97183239 -0.24697121  2.71598965] 推定値 [-2.57813775  0.35402029  3.04819815] 誤差: 0.7184610237387705\n",
      "343 真値: [-1.25024577 -0.88812777  7.96425557] 推定値 [ 0.27118507 -0.92374777  8.1648968 ] 誤差: 1.52184774818108\n",
      "344 真値: [ 5.95801326 -4.21330907  2.37323019] 推定値 [-2.13553944 -1.83404479  5.55900822] 誤差: 8.436023580024715\n",
      "345 真値: [ 4.33336117 -2.16804365  3.7790136 ] 推定値 [-1.06292789 -2.35518776  6.37449473] 誤差: 5.3995331810397476\n",
      "346 真値: [-0.82995853  0.12518914  4.54421751] 推定値 [-1.17797742  0.31659979  4.5775165 ] 誤差: 0.3971840679525006\n",
      "347 真値: [ 4.99189309 -3.77689118  1.97422985] 推定値 [-1.49442522 -3.62352025  5.42605331] 誤差: 6.4881313068550535\n",
      "348 真値: [ 1.67793895 -2.42371067  2.68365191] 推定値 [-1.49883687  1.14042523  8.03421354] 誤差: 4.7744077424590365\n",
      "349 真値: [ 0.11929172 -2.22049738  2.12964683] 推定値 [ 2.07663543 -0.67249305  1.85821258] 誤差: 2.495498311679799\n",
      "350 真値: [-0.91967536  3.85824456  2.01212576] 推定値 [ 3.56793892 -0.68102026  4.08759164] 誤差: 6.3830719043331445\n",
      "351 真値: [ 2.89908217 -0.34545731  4.38369596] 推定値 [1.82732357 1.21854764 4.83542072] 誤差: 1.8959899771265947\n",
      "352 真値: [-0.20955788 -5.78839518  6.3381874 ] 推定値 [1.10582607 2.71114972 3.95586856] 誤差: 8.600726616914269\n",
      "353 真値: [3.3842129  3.66562921 2.73066819] 推定値 [2.16292249 4.73061742 3.3833392 ] 誤差: 1.620416659249074\n",
      "354 真値: [3.14486077 5.85679221 3.69065021] 推定値 [-2.39193887 -2.78526454  6.07824165] 誤差: 10.263590756173247\n",
      "355 真値: [-5.14526545  0.55552338  5.77480087] 推定値 [2.52122294 0.10132008 7.13299274] 誤差: 7.679931306572247\n",
      "356 真値: [ 1.92863017 -2.20426396  3.99779195] 推定値 [ 1.16220202 -2.57081089 11.23460336] 誤差: 0.8495697474542419\n",
      "357 真値: [1.90408212 0.04584444 4.07602207] 推定値 [ 1.69315424 -0.01817972 10.42743689] 誤差: 0.22043063000463262\n",
      "358 真値: [-3.49960097  4.16360563  4.11572684] 推定値 [-1.19511123 -2.21234457  2.47883645] 誤差: 6.77963227953896\n",
      "359 真値: [ 1.50228521 -4.57181139  5.1395797 ] 推定値 [ 0.72338372 -2.88136762  3.86334328] 誤差: 1.8612597014765753\n",
      "360 真値: [-4.27261154  3.61945399  7.03587843] 推定値 [-5.72497458  2.49803865  8.77308704] 誤差: 1.8349198199050858\n",
      "361 真値: [-0.71129346 -0.77717283  6.43387823] 推定値 [-0.84121025 -0.81301856  6.4513416 ] 誤差: 0.13477124088078554\n",
      "362 真値: [-5.10407351  3.36729398  5.79105651] 推定値 [-3.33832388  0.32248463  2.3285502 ] 誤差: 3.5197635967819965\n",
      "363 真値: [-4.11323345 -0.30076932  3.34186321] 推定値 [-2.30391202  1.16598101 10.57115312] 誤差: 2.3291630647589683\n",
      "364 真値: [1.700108   1.18639085 2.68531283] 推定値 [2.05314737 0.44663305 8.78738146] 誤差: 0.8196818903184128\n",
      "365 真値: [3.54559236 3.16669291 4.83840378] 推定値 [3.6827377  3.15600763 4.31789305] 誤差: 0.13756096275036883\n",
      "366 真値: [ 1.30707734 -0.34794361  3.42313182] 推定値 [ 1.63984501 -0.9766509   3.35396708] 誤差: 0.7113418099764808\n",
      "367 真値: [-2.95884049  2.89324214  2.66997126] 推定値 [ 0.08118071 -1.78353049  3.81217276] 誤差: 5.577986291136072\n",
      "368 真値: [-1.18004955 -2.75001749  5.98415532] 推定値 [-1.03926938  0.62107249  5.16048925] 誤差: 3.3740282623224034\n",
      "369 真値: [0.31521029 0.37881477 4.29943126] 推定値 [ 0.03331069  0.15009169 10.58871727] 誤差: 0.3630174009284207\n",
      "370 真値: [ 2.10756482 -2.31092156  5.81782833] 推定値 [-2.09047614  3.33356749  5.63516819] 誤差: 7.034472589123762\n",
      "371 真値: [-3.83881702 -1.04069059  4.47743366] 推定値 [-3.2148283  -0.98364841  4.68607937] 誤差: 0.6265905616982478\n",
      "372 真値: [-0.60872546 -3.47151754  2.75107271] 推定値 [-0.8985202  -2.59273387  2.04416587] 誤差: 0.9253333129347194\n",
      "373 真値: [ 4.01533641 -4.76763999  2.52423588] 推定値 [1.86108498 0.86302601 4.76995386] 誤差: 6.028697942827891\n",
      "374 真値: [ 4.8952648  -0.38493757  0.91991215] 推定値 [-1.14245381 -0.63208888  9.67509585] 誤差: 6.0427750009333385\n",
      "375 真値: [1.41674511 1.64241898 6.47410069] 推定値 [1.71258603 1.28485324 6.58872152] 誤差: 0.4640852412699462\n",
      "376 真値: [ 1.68885177 -1.27693432  5.37132032] 推定値 [ 2.9968331  -0.72682856  4.70009877] 誤差: 1.4189543667671438\n",
      "377 真値: [-1.59808471 -3.63431736  8.5234042 ] 推定値 [-1.24012508 -2.87219677  1.92272277] 誤差: 0.8419993464124949\n",
      "378 真値: [1.05755308 1.27736723 7.23452913] 推定値 [0.49752628 1.97491995 6.85729948] 誤差: 0.8945444719944223\n",
      "379 真値: [-0.9834493 -2.1602192  7.1532045] 推定値 [ 0.99284396  0.24738923 12.39169465] 誤差: 3.1148536689247535\n",
      "380 真値: [1.11077598 1.97036599 3.2070464 ] 推定値 [ 1.46316577 -1.86641524 -3.69393784] 誤差: 3.8529298963497345\n",
      "381 真値: [-2.81455385  2.44331291  4.11295784] 推定値 [-3.088187    1.57484578  3.2294729 ] 誤差: 0.9105549164886695\n",
      "382 真値: [-0.27857344  4.29900836  5.80979741] 推定値 [ 1.93416273 -0.72951667  1.17116382] 誤差: 5.493838853761275\n",
      "383 真値: [2.09603114 1.08502937 5.359     ] 推定値 [2.65770881 1.04211992 5.2345984 ] 誤差: 0.5633143270391283\n",
      "384 真値: [ 3.08206446 -6.46237598  6.7233131 ] 推定値 [3.01921322 1.14662892 3.25142281] 誤差: 7.609264479628628\n",
      "385 真値: [-2.12050906 -3.89583315  7.45794928] 推定値 [-2.46477282 -3.16657326  7.23070253] 誤差: 0.8064350650095247\n",
      "386 真値: [ 4.91089774 -3.16252809  4.37923603] 推定値 [0.55462477 1.74075372 6.48083995] 誤差: 6.558908956527041\n",
      "387 真値: [-1.22648831 -1.23046008  7.26522615] 推定値 [-1.35764815 -4.56813621  1.59253796] 誤差: 3.34025221476927\n",
      "388 真値: [-4.02927062 -4.12475866  7.78094143] 推定値 [2.16370633 3.47910854 2.1807118 ] 誤差: 9.806720131905786\n",
      "389 真値: [ 1.89090763 -1.43313802  7.69778444] 推定値 [ 1.73627968 -1.61572696  7.63722724] 誤差: 0.2392666390534044\n",
      "390 真値: [-3.05851278  2.67715383  3.52987794] 推定値 [-2.91789709  2.48858474  3.36768375] 誤差: 0.23522558327870477\n",
      "391 真値: [-4.31346878 -2.6975525   8.8190116 ] 推定値 [-0.12335187 -1.0419576   3.46944366] 誤差: 4.50533841263557\n",
      "392 真値: [ 1.20817586 -1.71382547  7.02917351] 推定値 [ 1.5974286  -2.00202639  7.10694694] 誤差: 0.48433198054008597\n",
      "393 真値: [-1.39507272  4.61962405  2.94383395] 推定値 [-1.49377375  4.47533611  3.01661744] 誤差: 0.17481676917367847\n",
      "394 真値: [-5.53441587  4.01817126  5.78612596] 推定値 [-0.30272257 -4.38747818  2.67317339] 誤差: 9.900785686446733\n",
      "395 真値: [-0.14945638 -1.9597146   7.28353822] 推定値 [-2.94819808  3.04194361 -0.04876303] 誤差: 5.731451817764973\n",
      "396 真値: [ 0.33096149 -1.24938445  6.41903706] 推定値 [ 0.39467255 -1.58760692  6.46012302] 誤差: 0.3441707958267378\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "397 真値: [-5.61515987 -3.829433    5.89330828] 推定値 [-2.44057646 -2.92571881  6.09175358] 誤差: 3.3007088938281304\n",
      "398 真値: [-4.72681979 -0.89226373  6.16616224] 推定値 [-4.78918367 -0.16666922  5.95247577] 誤差: 0.7282696217231996\n",
      "399 真値: [3.51570716 3.96896205 2.75072206] 推定値 [ 6.33825907 -7.0598517   7.13541227] 誤差: 11.384266862841589\n",
      "400 真値: [ 2.04104183 -4.81622712  8.28661769] 推定値 [ 0.96876953 -1.19218958 -0.69114724] 誤差: 3.779340678008179\n",
      "401 真値: [-0.59853285  2.33790514  4.06100288] 推定値 [-1.10960475  2.18170662 10.36730571] 誤差: 0.5344085169648537\n",
      "402 真値: [-3.8515499   4.06374845  5.8915384 ] 推定値 [-2.30755538  0.6053563   3.59932439] 誤差: 3.7873995471479676\n",
      "403 真値: [-5.14361267 -1.01587703  6.60387232] 推定値 [-0.36979529  3.25097816  2.55922203] 誤差: 6.402763901618227\n",
      "404 真値: [ 0.3739319  -2.5795583   7.29150079] 推定値 [ 0.58046708 -1.82698926  6.6351829 ] 誤差: 0.7803953758852619\n",
      "405 真値: [-3.85474335 -4.54823882  6.80026621] 推定値 [-3.09953763 -4.29834806  6.52433788] 誤差: 0.7954753742524324\n",
      "406 真値: [ 3.36256457 -3.68383331  6.12294514] 推定値 [ 3.62193394 -2.73682286  6.92101699] 誤差: 0.9818865826834471\n",
      "407 真値: [-0.64986724  0.26322257  5.12608303] 推定値 [-0.74077091  0.23256545  5.14571232] 誤差: 0.09593401504280615\n",
      "408 真値: [3.68036894 3.26280146 8.07374362] 推定値 [-3.43001482 -0.68918232  3.11142158] 誤差: 8.134846835264403\n",
      "409 真値: [-2.92001034 -2.21969426  6.73248925] 推定値 [-3.2749681  -1.68729401  0.38797551] 誤差: 0.6398789234025107\n",
      "410 真値: [ 3.61833308 -3.29570775  6.47487532] 推定値 [ 2.57969537 -1.37204559  7.79607675] 誤差: 2.1861483057340045\n",
      "411 真値: [ 2.21905069 -1.55716373  5.75529721] 推定値 [ 1.69306909 -4.35551222  2.50481713] 誤差: 2.847351566789408\n",
      "412 真値: [1.48862698 4.08532137 2.22552303] 推定値 [1.51824993 4.15181119 2.41898688] 誤差: 0.07279022027021066\n",
      "413 真値: [1.62373779 0.16875163 1.6434797 ] 推定値 [ 1.52240948 -0.61354389  1.72622677] 誤差: 0.7888305989551769\n",
      "414 真値: [ 2.13267957 -1.3280039   4.93788849] 推定値 [ 1.62127782 -1.55163191  5.26744953] 誤差: 0.5581587869680376\n",
      "415 真値: [-1.7539923   0.96004003  4.98748578] 推定値 [-2.00532651  0.95416585  5.04847412] 誤差: 0.25140284707885824\n",
      "416 真値: [-3.05389305 -5.24276188  6.82403863] 推定値 [-3.11129378 -6.09588412  0.61409954] 誤差: 0.8550511016887508\n",
      "417 真値: [ 1.86983708 -4.48749044  6.81442554] 推定値 [-5.43060293e-04 -3.05296372e+00  5.38957250e+00] 誤差: 2.3571569243498924\n",
      "418 真値: [ 0.71636725 -4.14644916  8.8638645 ] 推定値 [-0.12783672 10.34364966  1.79766983] 誤差: 14.514669964446163\n",
      "419 真値: [-2.55383628  2.22933285  6.86066627] 推定値 [-5.36962925  2.24106444  2.26160908] 誤差: 2.815817414188213\n",
      "420 真値: [-1.53757392 -2.16760214  8.27659802] 推定値 [-1.55537909 -3.00468513  1.77257934] 誤差: 0.8372723328374521\n",
      "421 真値: [0.71239085 3.10681768 2.23700059] 推定値 [0.72430681 3.15853649 2.21926657] 誤差: 0.05307377753302618\n",
      "422 真値: [-3.95864305  2.46675992  4.10591089] 推定値 [0.87443975 1.15521051 6.14046554] 誤差: 5.007878907208641\n",
      "423 真値: [-4.47067708 -6.14429937  7.40995451] 推定値 [2.82882024 1.70928587 6.8522999 ] 誤差: 10.722008315550898\n",
      "424 真値: [-0.85881397 -3.51353214  2.87051338] 推定値 [-0.7647206  -1.67216224  8.69287807] 誤差: 1.8437723961674026\n",
      "425 真値: [4.67642644 5.69964444 3.57842386] 推定値 [-1.22448225  1.22758896  6.09427975] 誤差: 7.404053178255778\n",
      "426 真値: [0.60837258 1.83548311 5.63902406] 推定値 [ 1.7899566   1.24868504 11.69535787] 誤差: 1.3192697886142102\n",
      "427 真値: [ 0.11362905 -0.51472877  3.32517692] 推定値 [0.30676537 1.23747692 3.65403459] 誤差: 1.7628177578278847\n",
      "428 真値: [ 3.83709506 -0.57408614  8.19103352] 推定値 [ 2.51276766 -1.68519614  7.90859798] 誤差: 1.728701395361327\n",
      "429 真値: [ 3.21080164 -0.67516768  3.2367706 ] 推定値 [-0.29647428  3.41489965  1.01532286] 誤差: 5.3879156622152\n",
      "430 真値: [ 3.0497523  -4.73084496  7.93941422] 推定値 [-4.65152405  1.424893    6.12780639] 誤差: 9.859146379126564\n",
      "431 真値: [-1.68107216  2.6088943   8.78148786] 推定値 [ 0.81504853 -1.46193916  1.67091152] 誤差: 4.775175763606244\n",
      "432 真値: [2.66652767 0.17751942 7.78215073] 推定値 [ 2.26187263 -0.10398199  7.65351715] 誤差: 0.49293888839550953\n",
      "433 真値: [-0.72270445  1.04139283  5.12181235] 推定値 [0.1568472  1.87938896 4.82852626] 誤差: 1.2148450960535973\n",
      "434 真値: [4.66592015 0.65051658 2.013705  ] 推定値 [-1.62970655  0.47505956  6.46420814] 誤差: 6.298071194076456\n",
      "435 真値: [ 1.31704168 -0.9284448   4.18396734] 推定値 [-0.5428457  -0.90125233  4.7251253 ] 誤差: 1.8600861580740482\n",
      "436 真値: [0.96743667 0.14561272 5.45568859] 推定値 [1.74394493 0.47008029 5.18033156] 誤差: 0.8415725062777553\n",
      "437 真値: [-4.31882403  4.91202235  4.88134482] 推定値 [-2.22540001 -0.39474985  8.54058738] 誤差: 5.704757246231949\n",
      "438 真値: [-0.8283183  -2.97777561  3.14374989] 推定値 [ 0.25335223 -1.22094817  9.72224587] 誤差: 2.063117493228309\n",
      "439 真値: [-1.0129226   0.13013975  4.73546268] 推定値 [-1.35479291 -0.16697552  4.82028038] 誤差: 0.45293795636897827\n",
      "440 真値: [-5.40765778 -3.48334652  5.94556258] 推定値 [ 1.70293619 -0.83161622  6.84871377] 誤差: 7.588953828358779\n",
      "441 真値: [-3.37631803 -1.28741239  5.02623756] 推定値 [-1.61000708 -0.39649552  4.66226204] 誤差: 1.9782788601034917\n",
      "442 真値: [-1.74773583 -1.32451491  6.10473224] 推定値 [-1.41680389 -1.37206069  6.08024476] 誤差: 0.33433000566154425\n",
      "443 真値: [ 4.64245975 -2.20002708  2.37558711] 推定値 [ 5.81250407 -2.40806042  2.52549395] 誤差: 1.1883945338860105\n",
      "444 真値: [-3.50977027  2.5730704   7.02546285] 推定値 [ 2.90036064 -3.10265026  6.65929341] 誤差: 8.561751178584005\n",
      "445 真値: [ 6.00770065 -2.62870474  3.51659217] 推定値 [-2.5429987  -5.01076061  7.00030115] 誤差: 8.876297062855803\n",
      "446 真値: [-0.49219663  2.56324022  7.35989068] 推定値 [-0.21774433  1.10884704  7.73562273] 誤差: 1.4800620225524168\n",
      "447 真値: [ 4.24189301 -4.22332364  8.31772363] 推定値 [-1.08044257 -1.15172491 11.38401683] 誤差: 6.14507727689851\n",
      "448 真値: [5.96313757 3.85673548 2.41487703] 推定値 [ 2.65859618 -8.27798923  6.8065919 ] 誤差: 12.576626635697597\n",
      "449 真値: [0.96615226 1.96069813 8.89162423] 推定値 [2.60549377 0.72215406 8.73363381] 誤差: 2.0546123696397323\n",
      "450 真値: [1.4421276  3.6952254  5.01107394] 推定値 [0.51972406 1.37366099 5.98745071] 誤差: 2.49809720195446\n",
      "451 真値: [0.19617847 2.52003225 3.49368898] 推定値 [-0.00999997  2.50177846  3.48301777] 誤差: 0.2069848999443013\n",
      "452 真値: [5.30181919 5.04298646 3.62525118] 推定値 [0.11413141 1.38611425 6.64938894] 誤差: 6.347032284573699\n",
      "453 真値: [-0.34093564  5.24718766  5.51022682] 推定値 [-0.40237045  4.58252929  5.61136648] 誤差: 0.6674915596443605\n",
      "454 真値: [-3.43236985 -4.13283861  8.32642685] 推定値 [-2.36467011 -2.70054639  7.8487922 ] 誤差: 1.7864612342766757\n",
      "455 真値: [-3.67011248 -1.47657848  6.24353851] 推定値 [-2.54470951 -1.28237439  6.17878882] 誤差: 1.1420363715033555\n",
      "456 真値: [4.4801877  2.81671412 8.87895508] 推定値 [4.29764305 2.6543458  2.4238745 ] 誤差: 0.24430722191798698\n",
      "457 真値: [-2.53179115 -5.67312952  6.32682955] 推定値 [-2.48429928 -6.13321217  0.11793785] 誤差: 0.4625273148226339\n",
      "458 真値: [-1.08112811  0.16224025  3.88549626] 推定値 [-1.43243768 -0.33755461  3.84276932] 誤差: 0.6109118718731175\n",
      "459 真値: [ 2.12403721 -2.37639402  7.98124418] 推定値 [ 2.22038698 -2.22364379  7.95007523] 誤差: 0.18059875621907168\n",
      "460 真値: [1.00478249 4.63096151 3.90217854] 推定値 [-2.09041153 -2.66156536  8.60777355] 誤差: 7.922195035321776\n",
      "461 真値: [-4.03649893  3.87282313  5.21643674] 推定値 [-4.60399532  0.07145879  7.92054259] 誤差: 3.843490994105018\n",
      "462 真値: [ 2.47052113 -4.37161852  5.66824141] 推定値 [ 1.75029932 -2.8082309   6.99741418] 誤差: 1.7213077214330017\n",
      "463 真値: [3.45590306 1.72137119 3.45833772] 推定値 [3.24703206 1.56047392 3.41336884] 誤差: 0.2636570225231707\n",
      "464 真値: [-2.72866043  5.9492172   4.30788812] 推定値 [-2.9943795   4.7162236   4.24103087] 誤差: 1.2613008520094973\n",
      "465 真値: [0.89259768 5.52233785 3.72596318] 推定値 [-0.5590461  -3.72009192  8.37457227] 誤差: 9.355735017722433\n",
      "466 真値: [3.02652836 3.3154239  4.41404236] 推定値 [-6.68535765  2.0882994   4.87239844] 誤差: 9.78910437389208\n",
      "467 真値: [2.53271252 2.51736377 4.11775032] 推定値 [-2.98271423 -5.80878595  6.24729297] 誤差: 9.98722690633542\n",
      "468 真値: [1.12398257 1.47946267 2.37965894] 推定値 [1.06743559 1.64658293 8.61588176] 誤差: 0.1764277219430278\n",
      "469 真値: [5.39154341 4.86662086 2.79094198] 推定値 [3.80944709 5.89895542 3.41352192] 誤差: 1.8891118049931974\n",
      "470 真値: [-0.45573847  3.5678237   5.02822332] 推定値 [ 1.60948762  2.65555924 11.03277474] 誤差: 2.2577389698909056\n",
      "471 真値: [-0.5929491   0.40947474  4.70857295] 推定値 [-6.26867813  2.12990378  5.29212915] 誤差: 5.930748356495096\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "472 真値: [ 3.29050689 -0.67589831  7.95478232] 推定値 [ 2.27802963 -0.53895724  7.69904858] 誤差: 1.0216961611767659\n",
      "473 真値: [-3.74739263e-03 -1.63364660e+00  7.25159934e+00] 推定値 [ 0.12378063 -1.3355707   7.24944913] 誤差: 0.32421078775225615\n",
      "474 真値: [0.31027291 4.89752553 3.99095037] 推定値 [-5.11336694  5.73997887  5.26993896] 誤差: 5.488678974131228\n",
      "475 真値: [ 3.63203003 -2.02067464  8.50764748] 推定値 [-2.43529016  2.48672016  6.90077852] 誤差: 7.558371655991114\n",
      "476 真値: [-2.51390689 -0.09221871  4.26829114] 推定値 [-2.63797426  0.38927674  4.12084557] 誤差: 0.4972228647788449\n",
      "477 真値: [5.36576986 3.08268895 8.54576876] 推定値 [-4.36692223 -1.94372118  6.06188816] 誤差: 10.953999008194087\n",
      "478 真値: [ 3.43433065 -1.06598832  2.35175814] 推定値 [ 3.01340857 -0.75053879  2.17045125] 誤差: 0.5260074108391406\n",
      "479 真値: [-4.00041496  3.13666878  6.97905906] 推定値 [-3.01577375  1.73197679  5.01570849] 誤差: 1.7154235320035456\n",
      "480 真値: [0.54684921 0.77792943 8.72537349] 推定値 [1.04868562 1.23001572 8.72850197] 誤差: 0.6754419229581649\n",
      "481 真値: [0.95572172 2.83889129 4.93304706] 推定値 [-0.58468731 -2.07804155 10.41055393] 誤差: 5.152580764497704\n",
      "482 真値: [1.06308765 2.11406366 6.86185571] 推定値 [0.77347403 1.59400819 0.75095152] 誤差: 0.5952593910251672\n",
      "483 真値: [-2.40230076  0.18459904  2.47348867] 推定値 [-1.33666985  2.45030806  9.80514115] 誤差: 2.5037984337828303\n",
      "484 真値: [4.231949   3.67588967 5.06450819] 推定値 [2.48331662 1.57399923 2.44772332] 誤差: 2.734165073260604\n",
      "485 真値: [3.23910944 1.29083858 5.71596935] 推定値 [2.43491629 1.01545158 6.03706483] 誤差: 0.850038014999218\n",
      "486 真値: [2.45639805 0.48107657 5.5525663 ] 推定値 [2.81087441 0.79738297 5.59566761] 誤差: 0.47508233277356987\n",
      "487 真値: [4.01593645 0.94147435 8.48507906] 推定値 [-5.52373294e-03  3.22759434e+00  6.36247444e+00] 誤差: 4.625849827990844\n",
      "488 真値: [-4.3445748   4.5969321   7.49910864] 推定値 [7.57865905 2.74306461 8.29987696] 誤差: 12.066496181779439\n",
      "489 真値: [-4.3870818   4.98926614  6.0503746 ] 推定値 [-0.43392728 -0.24848668  3.68530463] 誤差: 6.562125050323593\n",
      "490 真値: [ 1.88719405 -0.81822683  4.54244261] 推定値 [ 1.72560865 -0.84645724  4.61943627] 誤差: 0.1640329112419763\n",
      "491 真値: [-0.04080828  6.31393459  3.81925756] 推定値 [ 1.56962883 -0.88358316  7.64598477] 誤差: 7.375484355900604\n",
      "492 真値: [-5.26991523 -0.3083385   5.23479467] 推定値 [-1.54335733  1.61193924  7.27643815] 誤差: 4.19221902474064\n",
      "493 真値: [3.88807802 2.1523771  3.67023722] 推定値 [3.84488486 2.30421675 3.67527521] 誤差: 0.15786363523673086\n",
      "494 真値: [0.82103648 1.59495069 6.59121423] 推定値 [0.99954811 0.17189951 6.85721138] 誤差: 1.4342039750520033\n",
      "495 真値: [ 0.76918683 -2.33816256  5.48132155] 推定値 [ 0.90556478 -2.27177956  5.32116789] 誤差: 0.15167612632465485\n",
      "496 真値: [2.990893   0.82388471 5.16397131] 推定値 [2.6954141  0.48331695 5.23784329] 誤差: 0.45088155902636035\n",
      "497 真値: [3.47401837 1.52381487 6.118326  ] 推定値 [1.81188572 1.91187676 0.13162845] 誤差: 1.7068324399407866\n",
      "498 真値: [ 4.00340207 -2.35244329  7.60411111] 推定値 [-2.37937386 -0.2931064   6.28908061] 誤差: 6.706765014851163\n",
      "499 真値: [ 3.16391645 -2.03633092  1.81147962] 推定値 [ 2.7667132  -2.32805749  1.72901315] 誤差: 0.4928233047525185\n",
      "500 真値: [ 3.08295755 -4.05627493  6.05899237] 推定値 [-0.14628632  5.01334594  8.15978833] 誤差: 9.627358860206947\n",
      "501 真値: [3.28316674 1.12805702 7.30188617] 推定値 [2.80939496 0.97031864 7.07903819] 誤差: 0.49934066167304547\n",
      "502 真値: [ 4.93436412 -2.01964847  2.69136456] 推定値 [ 4.51456901 -2.6427699   8.79087998] 誤差: 0.7513376368590644\n",
      "503 真値: [3.7043623  2.0527108  3.09681887] 推定値 [3.79286688 2.43613409 9.73189609] 誤差: 0.3935053830725257\n",
      "504 真値: [-5.32365222 -5.09877895  6.22375857] 推定値 [ 3.61253371 -1.15992569  1.16360382] 誤差: 9.765755675570231\n",
      "505 真値: [ 2.86842774 -2.23326686  3.77633953] 推定値 [ 1.48132625 -2.09250896  5.12476319] 誤差: 1.3942249961501676\n",
      "506 真値: [3.96385036 2.89076184 8.77804085] 推定値 [-0.4642986   0.05664841  0.39263944] 誤差: 5.257442545513556\n",
      "507 真値: [-0.30675933  0.94612923  4.86123081] 推定値 [-1.1429863   0.51381684  5.00427998] 誤差: 0.9413657881152802\n",
      "508 真値: [2.91025939 5.1171447  5.41697962] 推定値 [ 1.81059471 -0.55658239  1.75805479] 誤差: 5.779311510904818\n",
      "509 真値: [6.5623982  2.24713325 1.85882235] 推定値 [4.5111441  2.82805763 8.39232369] 誤差: 2.1319278908725563\n",
      "510 真値: [-2.47515701 -0.81547497  8.56381283] 推定値 [-2.86484095 -2.0396172   1.94209052] 誤差: 1.2846703026693127\n",
      "511 真値: [ 1.19016463 -3.75824597  6.76178419] 推定値 [ 1.7680401  -1.79972922 -1.75635411] 誤差: 2.041991159010206\n",
      "512 真値: [-3.67312452  2.26142224  7.54160906] 推定値 [-3.74362391  1.49480777  5.80657356] 誤差: 0.7698492814707691\n",
      "513 真値: [-3.20494072 -3.1494943   5.39154434] 推定値 [-1.60617148 -1.60657106  4.97937879] 誤差: 2.2218629983963933\n",
      "514 真値: [ 4.33360701 -1.54114573  4.58607912] 推定値 [ 3.8391024  -1.99698316  4.43555325] 誤差: 0.6725493007727524\n",
      "515 真値: [-0.05937332 -0.80760328  6.32984109] 推定値 [-0.10277731 -1.08073665  6.4535753 ] 誤差: 0.27656056150516994\n",
      "516 真値: [ 1.73239285 -0.32163844  7.49816436] 推定値 [ 2.22942829 -1.72902699  7.66346553] 誤差: 1.4925772187112036\n",
      "517 真値: [-2.00220101 -2.61020376  5.30230025] 推定値 [-1.17631398 -1.11929854  4.8599923 ] 誤差: 1.7043731316300346\n",
      "518 真値: [-4.3491111  -2.83222231  3.76484618] 推定値 [ 2.47157016  0.60850403 11.42790974] 誤差: 7.639390720069047\n",
      "519 真値: [-1.56916016  0.84913789  7.49957039] 推定値 [4.66803355 0.40653716 2.83413593] 誤差: 6.25287779586896\n",
      "520 真値: [0.5666326  2.01371319 8.25429762] 推定値 [0.62174787 1.47986165 8.43946368] 誤差: 0.5366890731376298\n",
      "521 真値: [-4.08809067  0.29385606  6.37290149] 推定値 [ 3.61761762 -2.7041535   7.59775447] 誤差: 8.26837358225181\n",
      "522 真値: [4.31141226 0.49479043 6.0998216 ] 推定値 [-1.70553762 -5.42377209  8.82876095] 誤差: 8.439968490887983\n",
      "523 真値: [-3.45074519 -3.83992194  8.23927837] 推定値 [-1.65463976 -3.88280823  8.5124622 ] 誤差: 1.7966173627168107\n",
      "524 真値: [-3.07020655 -0.50089879  5.73576751] 推定値 [-2.68683161  2.3251157   5.3220795 ] 誤差: 2.8519001134352204\n",
      "525 真値: [4.96326211 2.73639941 3.41042032] 推定値 [1.00775733 3.255995   6.55514771] 誤差: 3.9894858834829914\n",
      "526 真値: [ 1.90253903 -3.26377915  6.4128551 ] 推定値 [-7.50728536 -3.38317264 13.167374  ] 誤差: 9.410581801605009\n",
      "527 真値: [-0.04174911  3.51440152  2.00848573] 推定値 [-0.25777649  4.18964701  1.82668886] 誤差: 0.7089600071167198\n",
      "528 真値: [-6.29390216 -4.33660801  5.6273935 ] 推定値 [3.34457853 1.16023087 7.62011541] 誤差: 11.095744573132261\n",
      "529 真値: [ 4.19603129 -1.47372424  5.63222351] 推定値 [ 3.09872534 -0.57430119 11.98170469] 誤差: 1.4188171674233916\n",
      "530 真値: [4.93460975 0.58837777 5.82480583] 推定値 [3.59442945 2.73482451 6.11427128] 誤差: 2.530477594004712\n",
      "531 真値: [-1.28284687  3.05730277  4.84354637] 推定値 [-1.34032931  2.56209907  4.68678087] 誤差: 0.4985287655990687\n",
      "532 真値: [-4.73277019  1.87410666  7.3475358 ] 推定値 [-4.74475871  1.85154463  7.40280008] 誤差: 0.0255493692364568\n",
      "533 真値: [0.69341689 3.22898141 2.21372257] 推定値 [1.05760249 4.01384193 2.03190192] 誤差: 0.8652382181438586\n",
      "534 真値: [ 4.94071215 -1.79623651  2.84671227] 推定値 [7.13246371 1.05144635 2.81574629] 誤差: 3.5934763942522316\n",
      "535 真値: [0.9893375  0.93837052 7.06625125] 推定値 [1.32813354 1.0935857  7.16947819] 誤差: 0.37265870388217776\n",
      "536 真値: [ 1.3013426  -1.90352653  3.62356602] 推定値 [ 0.71615696 -1.62828505  3.03669193] 誤差: 0.6466839351056818\n",
      "537 真値: [3.65176897 1.84999645 5.67536305] 推定値 [3.62904865 1.93059501 5.73335911] 誤差: 0.08373971599327532\n",
      "538 真値: [0.64531419 2.89057736 2.43270071] 推定値 [-1.08163809 -3.59090341  1.13969098] 誤差: 6.707604432789715\n",
      "539 真値: [ 1.48501297 -0.29076937  4.19757138] 推定値 [-1.69445793  1.53584368 11.13943728] 誤差: 3.666817480550188\n",
      "540 真値: [ 0.15307395 -3.29283242  6.53903937] 推定値 [ 0.5491584  -2.19482695  5.86669472] 誤差: 1.1672612861819784\n",
      "541 真値: [-5.70773039  1.10007894  6.46319718] 推定値 [ 2.40453772 -0.54357651  8.94968566] 誤差: 8.277106807368384\n",
      "542 真値: [3.7245864  3.58349313 4.03973276] 推定値 [3.85383059 3.45443126 3.86353329] 誤差: 0.18265000707266438\n",
      "543 真値: [-4.44428244 -1.51184294  5.74144145] 推定値 [-1.12211033 -1.37954449  6.53252215] 誤差: 3.3248053210531143\n",
      "544 真値: [-2.02615948  4.14202392  4.48222537] 推定値 [-1.32858528  3.895151    4.24154203] 誤差: 0.739970277684435\n",
      "545 真値: [-0.31700065  1.62275312  3.90797514] 推定値 [-0.59339889  2.03905535  4.01655985] 誤差: 0.4997034457628167\n",
      "546 真値: [ 2.24028802 -5.9060049   6.59902767] 推定値 [-3.59623139 -0.60590551  8.04312315] 誤差: 7.883908446542884\n",
      "547 真値: [ 4.04194641 -3.95047474  4.80414508] 推定値 [ 1.69727068 10.66447782  8.80407402] 誤差: 14.801835784636694\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "548 真値: [-0.68150787  2.70890394  4.85438968] 推定値 [-0.58111283  2.50681651  4.72563413] 誤差: 0.22565126656855058\n",
      "549 真値: [ 0.3098466  -0.49231596  4.36363576] 推定値 [0.56025647 0.0340134  4.09912145] 誤差: 0.5828616485438572\n",
      "550 真値: [0.24751165 4.39390166 3.73526077] 推定値 [-3.64678219 -2.50372214  1.75904075] 誤差: 7.921031409040432\n",
      "551 真値: [-0.70579349  4.39750258  6.08986091] 推定値 [-0.41984121  4.69919653  5.9709758 ] 誤差: 0.41567769731415716\n",
      "552 真値: [-0.23137888 -5.92921856  6.65626469] 推定値 [-1.27491931 -3.4044696   5.82600715] 誤差: 2.731910310814418\n",
      "553 真値: [0.99677063 4.39971584 3.8800302 ] 推定値 [-1.13855204 -2.37279224  2.43210612] 誤差: 7.101159665915597\n",
      "554 真値: [-0.33187649  2.50927409  2.35842387] 推定値 [ 2.88289758 -7.98447871 13.86765519] 誤差: 10.975136448432648\n",
      "555 真値: [-4.9584267   3.46485323  4.75577605] 推定値 [-2.4263501   3.11055524  3.21259897] 誤差: 2.5567438164305223\n",
      "556 真値: [-5.52675089 -3.95420726  6.02945367] 推定値 [-0.70292834  6.1185958   9.31268428] 誤差: 11.16828659672616\n",
      "557 真値: [-2.63617648  3.39635139  6.08528698] 推定値 [-4.88001988  3.10297127  6.19103995] 誤差: 2.2629416934966606\n",
      "558 真値: [0.69049842 0.77005325 2.60843635] 推定値 [0.61348078 0.7738408  8.91873536] 誤差: 0.07711071005279435\n",
      "559 真値: [-5.25376091 -2.6576004   6.95722821] 推定値 [-7.45135295 -1.16745028  6.30032455] 誤差: 2.655175731735576\n",
      "560 真値: [-4.97981647  3.12213833  9.34162185] 推定値 [-0.78995871  6.70565207  3.49838789] 誤差: 5.5133001703894005\n",
      "561 真値: [-5.18979433 -4.81691923  5.57611285] 推定値 [-3.37410486  2.40256069  6.69920411] 誤差: 7.44430107616325\n",
      "562 真値: [-0.37267843  2.52620209  7.21716825] 推定値 [0.29102808 0.72305089 7.6518632 ] 誤差: 1.9214215024105592\n",
      "563 真値: [-5.38250215 -3.14481797  5.84082671] 推定値 [0.07973323 0.52596771 7.77503489] 誤差: 6.581085235567056\n",
      "564 真値: [0.413926   3.41709237 3.64501853] 推定値 [1.15694316 3.10775859 3.55352485] 誤差: 0.8048365544779165\n",
      "565 真値: [ 2.99248635 -0.04550653  7.9545256 ] 推定値 [ 1.99480864 -0.26562165  7.58268966] 誤差: 1.0216709316056103\n",
      "566 真値: [-2.72174633  4.09731056  4.56746284] 推定値 [-1.66626749  2.10726994  3.59465513] 誤差: 2.252620087498539\n",
      "567 真値: [2.87725969 4.90545891 3.34003919] 推定値 [ 2.02330029 -8.40313927  7.10189211] 誤差: 13.33596761161439\n",
      "568 真値: [ 1.25390626 -1.78462029  3.53098928] 推定値 [ 2.74952083 -1.09799545 10.12770057] 誤差: 1.6456963881358786\n",
      "569 真値: [-2.29559315  0.02991309  2.85204824] 推定値 [0.17618998 1.52985113 3.56782853] 誤差: 2.891284486015213\n",
      "570 真値: [ 4.60476675 -0.57921673  7.78905997] 推定値 [ 2.71978596 -1.1779994   1.03495816] 誤差: 1.9778001105179592\n",
      "571 真値: [-0.35682733 -0.59167699  1.33033296] 推定値 [-0.83167905 -0.14851552  7.4796503 ] 誤差: 0.6495200089575327\n",
      "572 真値: [-2.69815121  5.0717635   4.51077804] 推定値 [6.82974414 5.50155385 9.54397425] 誤差: 9.537584051854353\n",
      "573 真値: [-4.76174632 -6.53437544  6.71462252] 推定値 [3.16009065 3.56241373 4.30192097] 誤差: 12.83357520613858\n",
      "574 真値: [2.88325311 2.9722689  6.1347563 ] 推定値 [2.96126657 3.07994588 4.72864855] 誤差: 0.1329677890724013\n",
      "575 真値: [1.17460109 2.67251923 4.22602678] 推定値 [1.45677119 2.78570254 4.29178704] 誤差: 0.30402373372688\n",
      "576 真値: [0.81435726 4.65232526 3.64019478] 推定値 [2.32946634 1.56181622 9.37744235] 誤差: 3.4419183153804758\n",
      "577 真値: [-0.45095285  4.67121106  5.65878256] 推定値 [ 2.01386819 -1.90149562  7.97702525] 誤差: 7.01967348811605\n",
      "578 真値: [-4.33317148 -1.6675544   5.31010479] 推定値 [-4.02299669 -1.68297884  5.98667748] 誤差: 0.3105580744805309\n",
      "579 真値: [-2.39346717 -3.34891845  4.07825068] 推定値 [-1.38656439 -3.75804805  4.29256352] 誤差: 1.0868487639942839\n",
      "580 真値: [-1.32162554  4.39937599  4.4836579 ] 推定値 [-6.98453744  3.69964527  6.27554679] 誤差: 5.705978815302069\n",
      "581 真値: [-4.33606896 -3.24322897  4.75673149] 推定値 [ 5.0309762  -6.00075286  0.92811475] 誤差: 9.764500647795488\n",
      "582 真値: [ 3.99965032 -0.93557862  4.53960271] 推定値 [-0.168017   -0.58094183 12.24480961] 誤差: 4.182728546378539\n",
      "583 真値: [2.25678355 1.96077258 2.14228149] 推定値 [2.48029004 1.96182481 8.4578464 ] 誤差: 0.22350897339172512\n",
      "584 真値: [-3.13048761  2.36825793  3.3682346 ] 推定値 [-3.16942467  2.55631886  3.58141948] 誤差: 0.19204949040597472\n",
      "585 真値: [-4.80650991 -1.17041452  3.7991609 ] 推定値 [-1.68054504 -0.93628351  5.37774461] 誤差: 3.1347206770417286\n",
      "586 真値: [-2.32767327 -1.97753973  4.92797014] 推定値 [-0.53206637  2.32967526  5.67322944] 誤差: 4.66650887913812\n",
      "587 真値: [2.71930212 0.9409612  5.50500365] 推定値 [1.71059313 1.45074807 5.72800974] 誤差: 1.1302108112195421\n",
      "588 真値: [-2.67482755  1.00226456  8.16186656] 推定値 [-4.25075895  0.36260251  0.69731413] 誤差: 1.7008019607995761\n",
      "589 真値: [-1.90698914  0.05027956  6.22879604] 推定値 [-2.32716169 -0.38606171  6.18238924] 誤差: 0.6057546312801907\n",
      "590 真値: [-0.44948013 -2.82330002  3.20009276] 推定値 [ 1.62068035 -0.23403009  8.62439181] 誤差: 3.315099265022966\n",
      "591 真値: [ 2.59083073 -5.28462332  1.80518621] 推定値 [ 1.97682905 -0.9634906   4.69876797] 誤差: 4.364537322726521\n",
      "592 真値: [0.77326776 2.09533045 5.03313517] 推定値 [-2.78546075 -4.08291746  6.62846306] 誤差: 7.129887502877303\n",
      "593 真値: [ 3.95735369 -1.3339862   5.05310094] 推定値 [-0.43239437  3.14423061 10.4842948 ] 誤差: 6.270910127760515\n",
      "594 真値: [-4.90731793  0.57883636  4.6943743 ] 推定値 [-2.05259954  1.28024098  6.57584413] 誤差: 2.9396233665307325\n",
      "595 真値: [-0.45115228 -1.72515956  5.14240762] 推定値 [-0.71555542 -1.89273831  5.24565324] 誤差: 0.3130361959419423\n",
      "596 真値: [-1.43486399 -2.97975468  5.83083178] 推定値 [-0.79154596 -4.56016385  6.34118134] 誤差: 1.7063268300776124\n",
      "597 真値: [1.62831272 3.68151139 5.13421912] 推定値 [1.98174074 2.07938691 6.2536101 ] 誤差: 1.64064444965512\n",
      "598 真値: [-3.38361334  5.07234004  3.47192441] 推定値 [-4.91138144  1.7366284   3.73731575] 誤差: 3.6689300157667164\n",
      "599 真値: [-1.95533866 -1.20022081  6.73053983] 推定値 [-1.24235609 -1.11270904  6.59307781] 誤差: 0.7183331057236898\n",
      "600 真値: [ 1.82893337 -3.4529389   6.17697748] 推定値 [-0.69584474  1.48246286  6.40301101] 誤差: 5.543707695213101\n",
      "601 真値: [-1.01515286 -0.59877806  3.6488007 ] 推定値 [-0.43717478 -0.2957054   9.91906333] 誤差: 0.6526191069504838\n",
      "602 真値: [-4.06796589 -2.20331971  8.30484481] 推定値 [1.42862474 0.91223027 3.34096065] 誤差: 6.318161134562409\n",
      "603 真値: [2.87175227 3.31941581 3.08344022] 推定値 [2.87013862 3.33283187 2.974396  ] 誤差: 0.013512759818155917\n",
      "604 真値: [-0.99572614 -2.78102317  4.70832372] 推定値 [-0.47940277 -2.79844879  4.94177059] 誤差: 0.5166173434996754\n",
      "605 真値: [-4.82258876 -1.39895725  5.57925684] 推定値 [-2.29343428 -0.47536292  6.99692508] 誤差: 2.6925172071918295\n",
      "606 真値: [ 4.60747066 -4.57781305  7.32804756] 推定値 [7.20760858 2.91625533 1.60405938] 誤差: 7.93232488614375\n",
      "607 真値: [4.77475072 1.63038716 4.7164131 ] 推定値 [2.04510518 5.12002167 5.16493961] 誤差: 4.430407856875687\n",
      "608 真値: [4.49893612 0.24306016 7.22897433] 推定値 [-1.00048541 -1.24365155  3.09863541] 誤差: 5.696836741191153\n",
      "609 真値: [ 4.1305558  -1.68451795  7.28516687] 推定値 [ 3.41099684 -1.73662174  7.12058046] 誤差: 0.7214429293038441\n",
      "610 真値: [-3.03381688 -5.56423253  7.53887635] 推定値 [ 3.22725748 -4.70834917  2.41062876] 誤差: 6.31930283894283\n",
      "611 真値: [-1.13130412 -3.82610836  7.84459396] 推定値 [ 5.60743532 -2.26789296  4.52231862] 誤差: 6.916548589963094\n",
      "612 真値: [-0.46405565  3.35168419  4.40926479] 推定値 [-0.67746243  3.83354076 10.86044877] 誤差: 0.5269992429929713\n",
      "613 真値: [5.10204716 2.39646184 8.93841153] 推定値 [-0.96974728  1.32671715 12.76609303] 誤差: 6.165309521648643\n",
      "614 真値: [-2.51211008 -4.98546224  6.47738531] 推定値 [-5.27789824  1.47594712  5.44198331] 誤差: 7.02847032245044\n",
      "615 真値: [ 2.48919376 -0.58479265  1.85989774] 推定値 [ 2.33064552 -0.90737968  1.78339937] 誤差: 0.359443922845183\n",
      "616 真値: [ 0.45104456 -4.93210038  7.09312056] 推定値 [-0.45513313 -4.17165149  6.67606817] 誤差: 1.182979507505348\n",
      "617 真値: [-5.03317914  3.48470792  5.2130921 ] 推定値 [-3.21926339  0.57605033  8.25231312] 誤差: 3.427911808442407\n",
      "618 真値: [-5.48105559  1.74776661  5.34848784] 推定値 [ 1.26734285 -1.48502563  4.46592493] 誤差: 7.482768677690409\n",
      "619 真値: [ 1.69575377 -3.98316761  5.00675817] 推定値 [2.63912986 2.5356256  4.56965518] 誤差: 6.586700490191194\n",
      "620 真値: [0.44901797 4.06620541 4.83964532] 推定値 [-0.436      -2.2285592   3.36343559] 誤差: 6.3566750974149056\n",
      "621 真値: [-0.11722494  1.28957692  7.21493457] 推定値 [-0.17397137  0.8595339   0.90802617] 誤差: 0.4337708579933489\n",
      "622 真値: [ 2.17823718 -1.57314253  6.7793429 ] 推定値 [ 2.34878145 -1.75608868  6.7851872 ] 誤差: 0.25010925628891895\n",
      "623 真値: [-4.36642277 -2.91249953  3.73950834] 推定値 [-2.95588118 -2.442239    4.64480169] 誤差: 1.4868666888703423\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "624 真値: [-3.01406675  3.89176237  5.1657575 ] 推定値 [-5.11190229 -2.81037026  2.30610147] 誤差: 7.022784046510449\n",
      "625 真値: [-3.19943773 -2.89891629  8.78468004] 推定値 [5.31204676 0.83479739 3.72323129] 誤差: 9.294406179861879\n",
      "626 真値: [1.48133864 1.45933141 3.92723908] 推定値 [0.61458604 2.42801249 4.07407078] 誤差: 1.2998473356457716\n",
      "627 真値: [-2.97572293  3.65732581  6.16807341] 推定値 [-3.39384172  0.12934656  3.53867673] 誤差: 3.5526695461858098\n",
      "628 真値: [-1.35657993  5.65416564  4.03132751] 推定値 [-1.14600683  5.97751409  4.00558683] 誤差: 0.38586948339384314\n",
      "629 真値: [ 1.28737016 -4.91145802  6.54502368] 推定値 [ 6.7974214  -1.69786034  2.93549549] 誤差: 6.378704776294538\n",
      "630 真値: [-1.22633299 -1.81449346  2.56788626] 推定値 [-1.10498861 -1.68861439  8.87654249] 誤差: 0.17484278784324184\n",
      "631 真値: [ 0.21244517 -1.43221203  4.71052434] 推定値 [-0.05491624 -1.74393986  4.84070837] 誤差: 0.4106779330893978\n",
      "632 真値: [-2.05501671  5.78367326  3.32097746] 推定値 [-2.19525542  4.21729534  3.00903937] 誤差: 1.572643214370891\n",
      "633 真値: [-2.28047985  2.2206867   7.0617924 ] 推定値 [-5.02566563 -0.67623295  0.96748568] 誤差: 3.991013458554598\n",
      "634 真値: [5.29983296 2.95713832 8.84688765] 推定値 [1.80353511 5.24468413 4.57731248] 誤差: 4.178153233471493\n",
      "635 真値: [1.83601627 0.22629458 4.65332178] 推定値 [2.3743558  0.72577146 4.49746527] 誤差: 0.7343613582727277\n",
      "636 真値: [1.1705808  4.89314891 6.56500986] 推定値 [0.21868924 2.99687945 7.24117575] 誤差: 2.1217764751602908\n",
      "637 真値: [-0.69695645  3.99831736  8.81135484] 推定値 [6.54004367 3.95309191 5.90000911] 誤差: 7.237141431581021\n",
      "638 真値: [ 0.830086   -2.40665086  7.15857214] 推定値 [ 1.19482366 -1.77664889  7.21135981] 誤差: 0.727967062558054\n",
      "639 真値: [-2.74015339 -0.96954765  5.76386067] 推定値 [-2.47278208 -4.25597361  0.1608929 ] 誤差: 3.2972841873668695\n",
      "640 真値: [0.31607567 5.07505693 3.2134907 ] 推定値 [-0.08861937  4.82586079  3.11442038] 誤差: 0.475264969538017\n",
      "641 真値: [ 2.86926468 -3.8492937   8.91012956] 推定値 [ 1.88158183 -1.86693137  5.1107756 ] 誤差: 2.214786179613517\n",
      "642 真値: [2.14560507 2.30930001 4.67923057] 推定値 [-0.09255406  2.6497153   4.98019532] 誤差: 2.2638990365390703\n",
      "643 真値: [-1.88078723 -3.84485437  6.01953337] 推定値 [-2.71105893  7.08899025 10.58545128] 誤差: 10.965323034297183\n",
      "644 真値: [ 3.2510241  -4.30866396  2.54037312] 推定値 [-2.15012045  2.51942435  5.61654891] 誤差: 8.706041145723653\n",
      "645 真値: [3.5882142  2.42821196 3.61630176] 推定値 [ 2.10408046 -8.78703607 -5.55194705] 誤差: 11.313020874521525\n",
      "646 真値: [7.36830713 1.04248683 2.21151107] 推定値 [-1.25443756  2.31473159  5.89328938] 誤差: 8.716096180243833\n",
      "647 真値: [-0.22288928 -0.28075032  8.58569408] 推定値 [-0.36831038 -0.77581695  2.23950159] 誤差: 0.5159828076351358\n",
      "648 真値: [3.13058411 2.38344847 8.66910537] 推定値 [2.9076354  2.42607035 8.29809839] 誤差: 0.2269862395685777\n",
      "649 真値: [-3.54112758  3.02764161  6.05120873] 推定値 [7.36136865 8.30908619 2.23141204] 誤差: 12.114374962452226\n",
      "650 真値: [-2.65696436  0.5022912   6.97260459] 推定値 [ 2.4864116  -1.75088826  6.6605332 ] 誤差: 5.615259031069268\n",
      "651 真値: [-5.59457912 -0.67399519  6.04109154] 推定値 [-0.51512694  0.68485878  1.00010942] 誤差: 5.25807175080042\n",
      "652 真値: [-2.1623898  -1.5190692   7.28202651] 推定値 [-3.12079991 -1.54866283  0.86838663] 誤差: 0.958866891733828\n",
      "653 真値: [ 1.05363598 -5.70809369  6.83621976] 推定値 [5.12046115 2.3533136  3.23508513] 誤差: 9.029139192789259\n",
      "654 真値: [-0.96633946 -0.79966385  3.33315178] 推定値 [-0.51935225 -0.05570067  3.43036041] 誤差: 0.8679163374836338\n",
      "655 真値: [-2.01237587  2.84615241  5.64547505] 推定値 [-2.50691004  1.85827834  5.81508289] 誤差: 1.1047439626683913\n",
      "656 真値: [-1.65124288  4.01511772  7.43433047] 推定値 [-1.43638421  2.22355656  7.64246349] 誤差: 1.8043989677250358\n",
      "657 真値: [1.37173494 4.65431715 4.21606975] 推定値 [2.84836719 5.08047504 3.04951641] 誤差: 1.5368973059241018\n",
      "658 真値: [ 6.38784161 -1.37672742  3.13814756] 推定値 [3.31225782 0.92668263 9.74821703] 誤差: 3.8425139574899942\n",
      "659 真値: [5.04844221 2.77728867 2.14361558] 推定値 [ 5.6058908  -6.63932132  7.23561232] 誤差: 9.433095594952855\n",
      "660 真値: [-1.63327149 -3.38301082  7.31288127] 推定値 [-7.37860011  4.04515163  5.28969015] 誤差: 9.390761331272813\n",
      "661 真値: [ 3.1080399  -6.68748011  6.76424014] 推定値 [-4.8756219   1.75888145  6.76123782] 誤差: 11.622386986549833\n",
      "662 真値: [-0.99282547 -4.46667038  6.61139101] 推定値 [-6.86313715  8.28301054  4.81472371] 誤差: 14.036200446390184\n",
      "663 真値: [-3.1571624  -4.47097288  8.28152261] 推定値 [-3.25662888 -2.61240031  7.9712075 ] 誤差: 1.8612322677741004\n",
      "664 真値: [-3.3862989  -1.56206715  3.77353061] 推定値 [0.70976181 0.00765631 4.44520651] 誤差: 4.386541355820098\n",
      "665 真値: [4.65805608 3.47187005 4.29364499] 推定値 [-4.12714905 -5.89884547  7.95781976] 誤差: 12.844848719007942\n",
      "666 真値: [ 3.59873952 -2.26200992  7.04410474] 推定値 [ 3.68963209 -1.856265    6.9431882 ] 誤差: 0.4158009152112322\n",
      "667 真値: [-1.4050503  -2.63481021  3.64875617] 推定値 [ 4.24390656 -2.24610364  8.82459728] 誤差: 5.662314580508297\n",
      "668 真値: [-2.26402248 -1.31674463  3.21167817] 推定値 [0.39092169 0.57264458 4.02234482] 誤差: 3.258607088204299\n",
      "669 真値: [ 0.47206123 -1.0986019   5.69798899] 推定値 [ 0.47672012 -1.29742888  5.74431909] 誤差: 0.19888155894337234\n",
      "670 真値: [3.24733873 4.3222032  2.19641172] 推定値 [3.03933618 4.32982803 2.37323376] 誤差: 0.2081422532566956\n",
      "671 真値: [-1.70197707  5.21075761  4.99334149] 推定値 [ 0.56729423 -1.52959255  9.58276676] 誤差: 7.112096212395968\n",
      "672 真値: [ 2.41244464 -3.66271018  2.51623419] 推定値 [ 0.64974749 -2.52603354  6.29939573] 誤差: 2.097411502722325\n",
      "673 真値: [ 6.53176389 -2.72074964  2.46441542] 推定値 [ 6.84582032 -2.30764672  2.5367075 ] 誤差: 0.518927228883904\n",
      "674 真値: [ 3.99275753 -1.66520725  7.38086623] 推定値 [ 3.09734951 -1.03428255  7.13078396] 誤差: 1.0953636381846337\n",
      "675 真値: [ 6.19796319 -5.06252357  2.25416242] 推定値 [-3.83781389  1.86936122  5.10793305] 誤差: 12.197042605268177\n",
      "676 真値: [1.73589797 2.59976217 4.19431605] 推定値 [0.43942919 4.09973374 4.84329294] 誤差: 1.9826109081851904\n",
      "677 真値: [-0.47198868  5.17713851  5.07341511] 推定値 [1.0557356  3.05782936 5.66068393] 誤差: 2.6125490884595526\n",
      "678 真値: [1.39543005 3.16642803 5.51379869] 推定値 [1.06364205 2.02866697 6.02474586] 誤差: 1.1851512584200392\n",
      "679 真値: [-4.16800074  3.06158607  5.63336878] 推定値 [-2.92962964  1.81375067  3.83394766] 誤差: 1.7580262112394696\n",
      "680 真値: [ 0.49025457 -0.5754883   2.34503163] 推定値 [ 0.5557248  -0.7788253   2.28483369] 誤差: 0.21361715072324786\n",
      "681 真値: [-3.95111861 -2.03140877  5.83815089] 推定値 [-4.07050574 -1.69191859  5.6645124 ] 誤差: 0.3598706283971618\n",
      "682 真値: [-2.23340524  2.49526131  6.26641486] 推定値 [-2.04717112  0.39392424 12.89641598] 誤差: 2.1095735658629633\n",
      "683 真値: [ 4.85321866 -3.75738896  2.01644283] 推定値 [5.97991526 2.67265022 9.42549311] 誤差: 6.528004985816701\n",
      "684 真値: [ 3.14276988 -1.0017385   3.14423847] 推定値 [-0.99211612  2.120487    7.73599113] 誤差: 5.1812714936462365\n",
      "685 真値: [-4.64872171 -3.76831696  6.8315018 ] 推定値 [-1.4374951  -4.10618687  7.35224043] 誤差: 3.228952207007189\n",
      "686 真値: [-1.86984155 -6.02589398  8.07938379] 推定値 [-0.4521018   4.23569143  6.22794866] 誤差: 10.35905985827418\n",
      "687 真値: [-2.55124488 -0.68553859  8.73248188] 推定値 [-2.71017652 -0.87396354  8.64292767] 誤差: 0.24650199106634998\n",
      "688 真値: [-2.24370106  3.38377724  4.79024071] 推定値 [-1.38187081  2.03550629 10.39444086] 誤差: 1.6001830952696134\n",
      "689 真値: [ 4.12145054 -4.67687348  3.57203021] 推定値 [ 0.30656308 -0.80936863  6.2682748 ] 誤差: 5.432399117003607\n",
      "690 真値: [ 5.34287733 -0.5748379   7.92675181] 推定値 [ 1.16822402 -0.05093441  6.76656333] 誤差: 4.207398847469931\n",
      "691 真値: [-0.42647055 -4.25477999  7.41875303] 推定値 [-0.79109141 -2.45874208  6.77333273] 誤差: 1.832675788235134\n",
      "692 真値: [1.46582987 1.23664159 3.21278369] 推定値 [1.66248828 0.988109   3.05919393] 誤差: 0.3169274111630319\n",
      "693 真値: [-4.22077865  0.56218083  7.13033654] 推定値 [ 1.22275945 -4.4723553   8.11524766] 誤差: 7.414759671955187\n",
      "694 真値: [0.78591809 2.18407909 5.00731189] 推定値 [0.41083911 1.84794323 4.98582563] 誤差: 0.5036581738824171\n",
      "695 真値: [-0.44266044 -3.91584004  6.92917945] 推定値 [-0.06926744 -3.73322886  6.96742388] 誤差: 0.41565512230007773\n",
      "696 真値: [ 3.25153908 -2.04114341  8.49408758] 推定値 [4.72889155 6.33757239 4.72037075] 誤差: 8.507963844955093\n",
      "697 真値: [-4.65150488  0.33056594  5.88737999] 推定値 [1.93342028 2.01447518 7.1821303 ] 誤差: 6.79682202253144\n",
      "698 真値: [-2.85984232 -2.39534965  2.6254043 ] 推定値 [ 0.140244    1.04595408 10.00131592] 誤差: 4.565423231178568\n",
      "699 真値: [-2.07264148  4.15069561  3.62639944] 推定値 [-1.97772185  3.66113217  3.46938895] 誤差: 0.49868036058964027\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "700 真値: [5.47741892 5.02520164 3.46252142] 推定値 [-0.67884745 -3.28955014  7.0360401 ] 誤差: 10.345758201638656\n",
      "701 真値: [-2.54090213  3.39676584  5.81298811] 推定値 [-2.18139152  3.81935949  5.67596346] 誤差: 0.5548272471036844\n",
      "702 真値: [1.94662339 3.7305636  2.82889754] 推定値 [ 2.3833415   1.88375012 10.64476361] 誤差: 1.8977467562829682\n",
      "703 真値: [-1.45012483  0.22755544  1.79218519] 推定値 [-1.32364396  0.36924291  8.10890608] 誤差: 0.18992826804801052\n",
      "704 真値: [-1.68758965 -5.70768275  6.05765431] 推定値 [-3.38495759 -3.06154574  5.3730304 ] 誤差: 3.1437396555504735\n",
      "705 真値: [2.36135675 2.02384023 8.12717347] 推定値 [2.48758714 2.06504375 1.86486435] 誤差: 0.13278494786642558\n",
      "706 真値: [-3.39463885  0.17847085  5.52273812] 推定値 [-3.66673602  1.50571587  3.62405967] 誤差: 1.354849147849349\n",
      "707 真値: [-3.14058587 -1.41170818  5.06617332] 推定値 [-2.60232835 -1.10588786  4.88536244] 誤差: 0.6190696475896568\n",
      "708 真値: [-2.17275897 -2.01653702  3.26120348] 推定値 [ 2.17303221 -0.62464814 10.22723981] 誤差: 4.563250556386372\n",
      "709 真値: [-2.16115354  1.20194696  7.76963619] 推定値 [ 2.21976697 -1.13665393  2.43329   ] 誤差: 4.966036521261329\n",
      "710 真値: [-4.53385224  0.9268436   4.14028823] 推定値 [-3.85288102  1.20725274  4.55476698] 誤差: 0.7364448943186948\n",
      "711 真値: [-0.26341922  0.29556602  7.95624999] 推定値 [-0.67782196  0.31569581  7.82162301] 誤差: 0.4148913609175963\n",
      "712 真値: [0.13923137 4.48267611 4.79910542] 推定値 [-3.80273634 -3.77149136  9.03603744] 誤差: 9.147152021222253\n",
      "713 真値: [2.0419569  1.8909267  1.76983932] 推定値 [1.69674234 2.11096931 1.57385598] 誤差: 0.409379829586493\n",
      "714 真値: [ 0.80557503 -1.43575145  7.57850273] 推定値 [ 0.76429809 -1.13628942  7.59970069] 誤差: 0.30229338690495977\n",
      "715 真値: [ 3.45028892 -2.69030012  4.58299549] 推定値 [ 3.67753146 -2.7989705   4.5943855 ] 誤差: 0.25188970841762626\n",
      "716 真値: [4.32038095 2.35623824 2.81101102] 推定値 [1.78086703 2.12180564 7.02322811] 誤差: 2.550311667155551\n",
      "717 真値: [-1.27935888  0.39818435  6.95869184] 推定値 [ 5.2560305  -4.87170397  1.91143824] 誤差: 8.395417641263004\n",
      "718 真値: [ 3.32787611 -0.93851656  5.94599535] 推定値 [ 2.91678475 -0.73739784  6.09939016] 誤差: 0.4576514473215613\n",
      "719 真値: [ 2.37428579 -3.39316545  7.38041317] 推定値 [0.84442463 4.30101289 4.95997046] 誤差: 7.84479799262145\n",
      "720 真値: [ 0.44024623 -3.034101    5.10743698] 推定値 [-3.54252756  4.34885479  9.81343803] 誤差: 8.388714036903508\n",
      "721 真値: [0.74893094 5.02183314 2.76628448] 推定値 [0.43242926 4.3726101  8.99168057] 誤差: 0.7222630184473886\n",
      "722 真値: [-4.21069264  6.03943815  3.31736089] 推定値 [-3.88153663 -1.36525675  6.89116823] 誤差: 7.412007163608409\n",
      "723 真値: [0.92689652 0.72377795 6.87345004] 推定値 [1.029933   0.84180219 6.95194331] 誤差: 0.15667238080444967\n",
      "724 真値: [-2.32854746  0.18109721  5.80594698] 推定値 [-2.66260281 -0.03276069  5.85413407] 誤差: 0.39664615868154024\n",
      "725 真値: [-3.62979604 -0.14378775  6.59878601] 推定値 [ 6.12564508 -2.68081361  4.4987501 ] 誤差: 10.079937083571725\n",
      "726 真値: [-1.45644543  1.94530502  8.45501688] 推定値 [-1.01639998  2.52362798  8.48584839] 誤差: 0.7267031377678835\n",
      "727 真値: [-4.05783466  3.32760771  2.29235889] 推定値 [ 5.98056655 -2.97541532  7.64235756] 誤差: 11.853168266838516\n",
      "728 真値: [ 3.90242261 -0.61095021  3.98362425] 推定値 [-2.012428    1.94408069 11.61031594] 誤差: 6.443107989676281\n",
      "729 真値: [4.40913768 1.54094151 7.22047911] 推定値 [1.3145178  0.97256783 1.89597481] 誤差: 3.146382184758145\n",
      "730 真値: [ 2.44126129 -1.90130205  8.79816016] 推定値 [-3.35858399 -1.1533734   7.95504271] 誤差: 5.847871620965411\n",
      "731 真値: [ 3.16057468 -3.17588478  4.71601602] 推定値 [ 1.64078136 -2.01455121  6.66491189] 誤差: 1.9127120506432993\n",
      "732 真値: [ 3.47152643 -0.3252021   8.70379932] 推定値 [ 3.75851992 -0.17011253  8.72492085] 誤差: 0.32621778146075675\n",
      "733 真値: [ 2.6808047  -3.38863712  1.90177942] 推定値 [1.85875084 2.0894623  3.87759647] 誤差: 5.539435512397546\n",
      "734 真値: [-0.32305701  3.10207758  4.98923067] 推定値 [-0.59624441  2.63358978 10.85448715] 誤差: 0.5423210943942116\n",
      "735 真値: [ 4.94793126 -0.33777486  2.6993102 ] 推定値 [-1.75172309  2.16962043  7.17572233] 誤差: 7.153488630357131\n",
      "736 真値: [ 2.92031558 -2.93522213  2.57735904] 推定値 [ 1.31701516 -2.20089824  4.18625214] 誤差: 1.7634635797005478\n",
      "737 真値: [ 4.02689049 -6.81867672  7.64980738] 推定値 [-0.88041622  0.93468558  4.70377438] 誤差: 9.175853431525077\n",
      "738 真値: [ 1.68569349 -1.75133238  7.50075176] 推定値 [-5.02870183 -0.01173101  6.5508852 ] 誤差: 6.936088048901699\n",
      "739 真値: [-2.3997821  -2.69362048  1.90037601] 推定値 [ 3.90736944 -1.29668678  2.69431297] 誤差: 6.459998789960145\n",
      "740 真値: [-0.65302713 -1.29445904  7.31258526] 推定値 [-0.13172539 -1.31121776  1.08078287] 誤差: 0.5215710478584838\n",
      "741 真値: [-2.00456506 -2.074509    3.61551837] 推定値 [ 0.17996132 -0.4818492  10.35895235] 誤差: 2.703464582862243\n",
      "742 真値: [-0.01649226  1.28003231  7.29575894] 推定値 [-0.09816912  0.77293651  7.32474222] 誤差: 0.5136314450813686\n",
      "743 真値: [ 0.74831059 -4.59947417  7.20767106] 推定値 [ 1.63605698 -0.86954911  4.85426875] 誤差: 3.834114582312617\n",
      "744 真値: [-0.47280029 -1.46910739  5.9481349 ] 推定値 [-0.56262324 -1.44967326  6.04464656] 誤差: 0.09190129719363638\n",
      "745 真値: [ 3.00875841 -3.18930217  3.6596351 ] 推定値 [ 0.98105179 -2.931547    6.94175821] 誤差: 2.0440234507678094\n",
      "746 真値: [2.39113111 1.53491413 3.56923596] 推定値 [3.28011563 1.47316898 4.24267349] 誤差: 0.8911262248246374\n",
      "747 真値: [-0.15609417  0.69287952  2.41613073] 推定値 [-0.2420262  -0.09284213  2.21296699] 誤差: 0.7904067409132923\n",
      "748 真値: [ 4.34430522 -4.49854676  4.57306957] 推定値 [ 5.12036221 -2.21646927 11.40220446] 誤差: 2.410423647999407\n",
      "749 真値: [ 1.36706769 -2.91695169  8.65901024] 推定値 [ 2.76747818 -2.83544872 -0.2565944 ] 誤差: 1.4027801955261272\n",
      "750 真値: [-3.66521685 -2.39900521  3.28957761] 推定値 [ 1.0140009   2.780799   11.53469711] 誤差: 6.980361768387603\n",
      "751 真値: [-0.84844144 -0.19500815  7.55013646] 推定値 [ 1.75059079 -0.43889367  8.05964343] 誤差: 2.6104498933729077\n",
      "752 真値: [-5.03407469 -2.29647487  6.06310656] 推定値 [0.52765298 1.78362878 8.11339411] 誤差: 6.8978301259435675\n",
      "753 真値: [ 0.47651517 -1.30771419  2.37946528] 推定値 [ 1.45522693 -0.80667706  8.79856861] 誤差: 1.099506667837549\n",
      "754 真値: [-0.68382717  4.23662016  2.5682661 ] 推定値 [-0.90933258  3.41032846  9.13353904] 誤差: 0.8565107443523984\n",
      "755 真値: [0.83940767 0.7860699  5.31917077] 推定値 [0.77219614 0.5686788  5.31785533] 誤差: 0.2275440158695731\n",
      "756 真値: [ 4.42507322 -5.12577166  7.73065685] 推定値 [4.6613114  0.51867177 9.37084521] 誤差: 5.649384928168059\n",
      "757 真値: [-0.51777852  3.74733945  4.3795109 ] 推定値 [-5.79867586 -1.19527244  8.03773445] 誤差: 7.233069132969901\n",
      "758 真値: [ 3.34652536 -1.01785939  6.8668241 ] 推定値 [ 2.74633957 -0.13125183  7.34040493] 誤差: 1.0706521140174945\n",
      "759 真値: [ 4.56861406 -2.52583796  3.18267698] 推定値 [6.50855776 7.52984136 4.07351445] 誤差: 10.24109702596165\n",
      "760 真値: [-0.23096338  6.25941916  3.45179588] 推定値 [-0.64369477  5.68822474  3.44775584] 誤差: 0.7047058063059823\n",
      "761 真値: [-1.89174942 -4.9157331   5.65258208] 推定値 [ 2.74247964 -7.43861184  6.16825597] 誤差: 5.276456777010918\n",
      "762 真値: [0.39577635 1.16970368 4.83449432] 推定値 [0.68182025 1.29091859 4.84933312] 誤差: 0.31066728864639015\n",
      "763 真値: [3.10502112 1.35843257 2.8690125 ] 推定値 [1.5706049 3.5458736 0.7597329] 誤差: 2.671952730791385\n",
      "764 真値: [-3.08643251  4.01140195  7.30191199] 推定値 [-5.95479151  1.25560363  9.3489959 ] 誤差: 3.9776761763963093\n",
      "765 真値: [-2.23636932 -2.6438038   6.65593282] 推定値 [-1.99502864 -3.14997986  6.71690796] 誤差: 0.5607669157541014\n",
      "766 真値: [-0.47414149  0.02370774  5.09192194] 推定値 [-0.75672146  0.0338138   5.04755548] 誤差: 0.28276063318988853\n",
      "767 真値: [ 3.88435857 -5.00227934  2.7581836 ] 推定値 [-0.72122186 -1.53924514  6.17482216] 誤差: 5.762289208640261\n",
      "768 真値: [ 1.09206925 -3.87267762  3.64690422] 推定値 [-5.23408294  6.70833866  7.71425943] 誤差: 12.327940098654741\n",
      "769 真値: [ 2.31507893 -2.43673049  8.41620177] 推定値 [-2.12702016  3.2478049   0.58825941] 誤差: 7.214304315017474\n",
      "770 真値: [-4.27657117  1.40057767  5.9161646 ] 推定値 [ 0.84317923 -3.96326776  3.44821772] 誤差: 7.415030811985709\n",
      "771 真値: [1.08211606 3.4009864  2.46404267] 推定値 [0.9295329  3.35989928 2.3841472 ] 誤差: 0.15801826077022993\n",
      "772 真値: [2.68252506 0.9882586  8.64042463] 推定値 [2.03991847 1.20247691 2.13904101] 誤差: 0.6773719155377306\n",
      "773 真値: [-1.26546283  5.10392231  6.57385913] 推定値 [-1.6349564   4.93448248  6.48424464] 誤差: 0.4064915165047351\n",
      "774 真値: [ 2.13548221 -2.48953624  2.05385409] 推定値 [ 2.09486973 -1.67218776  2.01563036] 誤差: 0.8183568399613833\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "775 真値: [-3.0120487  -3.10644393  2.69005711] 推定値 [-1.69204541 -2.50368343  9.28130315] 誤差: 1.4511129814276722\n",
      "776 真値: [-4.57551001  0.40567121  7.40382381] 推定値 [-2.78687661  2.74705404  3.59815248] 誤差: 2.946401707289697\n",
      "777 真値: [-3.35621788  4.51341678  3.41403687] 推定値 [-0.07323945 -2.52446886  6.58340815] 誤差: 7.765937266400122\n",
      "778 真値: [-3.28730488  1.52866839  3.08275851] 推定値 [ 3.50735289 -0.41667822  9.92413223] 誤差: 7.067655035245202\n",
      "779 真値: [3.44050919 4.71482395 4.86051811] 推定値 [2.03962006 1.34038419 7.7426917 ] 誤差: 3.653674048532207\n",
      "780 真値: [-0.75241024  2.25029584  4.95365525] 推定値 [-1.17177635  1.64054011  4.92026781] 誤差: 0.7400472839526495\n",
      "781 真値: [-1.6158347   2.24108032  8.05153487] 推定値 [-2.45629311  2.21955944  8.26835861] 誤差: 0.8407339044871338\n",
      "782 真値: [0.02012297 0.21496958 6.00503012] 推定値 [ 0.11358139 -0.08589166  6.01651101] 誤差: 0.3150427961871737\n",
      "783 真値: [-2.89664269  1.1392878   4.2838247 ] 推定値 [-2.70370832  1.4337086  10.49126246] 誤差: 0.35200465678652004\n",
      "784 真値: [-1.50985594 -3.15254564  6.93383665] 推定値 [-1.1034109  -5.21030394  1.24001486] 誤差: 2.0975144308350147\n",
      "785 真値: [-4.40722925 -3.56254055  5.2859855 ] 推定値 [-6.16787726 -3.38831262  4.97225427] 誤差: 1.7692475178984328\n",
      "786 真値: [-3.75724983 -0.52249399  3.44929642] 推定値 [-2.06697108  0.77462299  4.22822758] 誤差: 2.13062307238547\n",
      "787 真値: [-2.03040364  3.22576095  7.45376914] 推定値 [-1.98200408  3.36838013  7.37406363] 誤差: 0.1506079248149662\n",
      "788 真値: [-2.95783663 -6.48653275  6.77512078] 推定値 [2.28401616 0.29879523 4.05331226] 誤差: 8.57424612329187\n",
      "789 真値: [-3.96057508  2.42459195  6.74106867] 推定値 [-4.13729381  1.75318566  3.00461927] 誤差: 0.6942736554686532\n",
      "790 真値: [-2.85873221 -1.45028536  3.58896952] 推定値 [-0.42247273 -0.26415353  4.27531839] 誤差: 2.7096621480893424\n",
      "791 真値: [-1.80092349 -3.50586539  8.04810774] 推定値 [2.20700426 0.26381561 7.37552008] 誤差: 5.5021795421934785\n",
      "792 真値: [-0.87606266  3.85281236  7.64420949] 推定値 [0.20638139 2.68523997 7.8833616 ] 誤差: 1.5921401984956303\n",
      "793 真値: [ 5.19444956 -2.43087018  2.773155  ] 推定値 [-3.39813177 -1.26767921  0.18909158] 誤差: 8.6709553724448\n",
      "794 真値: [0.20841345 2.56370471 4.43359344] 推定値 [0.32779529 2.49389591 4.44648263] 誤差: 0.13829422120941537\n",
      "795 真値: [ 0.19854464 -4.10584753  7.01692142] 推定値 [ 1.33590309 -4.73898786  7.69171944] 誤差: 1.3017107696406502\n",
      "796 真値: [-1.83614822  4.33265744  3.32703522] 推定値 [-1.68383502  4.54361856  3.35800613] 誤差: 0.26019974006841423\n",
      "797 真値: [-2.75819157 -0.4785884   4.83545038] 推定値 [-3.17104219 -0.56713415 11.0947251 ] 誤差: 0.422239247024414\n",
      "798 真値: [ 0.64299378 -1.56966554  2.8447202 ] 推定値 [-0.09404506  5.53615864  6.81779879] 誤差: 7.143945930447604\n",
      "799 真値: [ 5.53336378 -3.95748478  8.31355303] 推定値 [-1.89592895  1.24277799  4.5887491 ] 誤差: 9.068468637217363\n",
      "800 真値: [-2.29073927  2.89693574  4.7914793 ] 推定値 [-4.39860893  0.18059296  8.75854312] 誤差: 3.438260116140622\n",
      "801 真値: [ 0.76372769 -3.81491468  4.95773225] 推定値 [ 3.21146477 -3.41595352  5.49391646] 誤差: 2.4800376619351345\n",
      "802 真値: [-1.46697174  0.49165311  4.47639622] 推定値 [-1.3824671   0.72910873  4.40040732] 誤差: 0.25204405985258155\n",
      "803 真値: [ 3.40592248 -1.61978889  8.60661394] 推定値 [-1.92418287  2.35273247  7.0770773 ] 誤差: 6.647627323118977\n",
      "804 真値: [-1.24843422  0.20018799  5.25369427] 推定値 [-1.42107684 -0.5315079   5.36910804] 誤差: 0.7517874305012655\n",
      "805 真値: [4.37009247 3.19513941 6.3811971 ] 推定値 [4.39423191 3.77961905 0.64530099] 誤差: 0.5849779226706527\n",
      "806 真値: [-0.99291807  3.38240981  7.99584063] 推定値 [-2.45223363  5.53059888  1.06551319] 誤差: 2.596982510191867\n",
      "807 真値: [ 1.54418249 -1.49672741  7.50529265] 推定値 [ 1.74181396 -1.2285396   7.50124837] 誤差: 0.3331409624420724\n",
      "808 真値: [-2.83038426  3.76892162  4.74163604] 推定値 [-2.98113483  3.8201774   4.8442371 ] 誤差: 0.15922590839378103\n",
      "809 真値: [-2.68358317  1.12806496  5.16081074] 推定値 [-2.38260601  1.32468193  5.46445555] 誤差: 0.35950728056024794\n",
      "810 真値: [1.87510892 4.23135936 5.66030477] 推定値 [ 0.40478912 -1.23278262  7.60168334] 誤差: 5.658505801978475\n",
      "811 真値: [1.77337225 3.23903911 4.22739075] 推定値 [2.11288756 3.68453278 3.97486931] 誤差: 0.5601207538351031\n",
      "812 真値: [-4.50747013 -0.3423121   6.40692278] 推定値 [-7.64347402 -4.36779496  4.48801048] 誤差: 5.102845547141131\n",
      "813 真値: [-1.33924428  4.50043357  5.58713274] 推定値 [-1.20989859 -1.78412694 10.5026407 ] 誤差: 6.285891430965826\n",
      "814 真値: [-1.39302304  1.19485093  6.17275451] 推定値 [-1.243311    1.09663769  6.15814225] 誤差: 0.17905176999327313\n",
      "815 真値: [-3.02512268 -2.58549964  4.03249624] 推定値 [-2.59246355 -1.4121518   4.0559335 ] 誤差: 1.2505754976371943\n",
      "816 真値: [-1.15316116  0.57178316  7.77733816] 推定値 [ 5.65665874 -2.3733509   9.26713649] 誤差: 7.41939766539825\n",
      "817 真値: [1.88625552 4.48772819 4.14536085] 推定値 [-4.99683993 -2.04845829 10.7782253 ] 誤差: 9.492035427426313\n",
      "818 真値: [-1.36170354  4.60275529  2.92021952] 推定値 [-1.88605269  3.06070922  8.55566555] 誤差: 1.628756610349303\n",
      "819 真値: [-0.70025297  2.65478176  2.86245742] 推定値 [3.25771334 1.95964017 2.58308205] 誤差: 4.018546887203437\n",
      "820 真値: [-3.86103433 -3.93605723  6.27402791] 推定値 [3.59765402 2.32928419 2.90092702] 誤差: 9.740971977968504\n",
      "821 真値: [-0.14786537 -4.59595628  2.43424793] 推定値 [ 0.74932789 -1.05030167  6.9329484 ] 誤差: 3.6574065064198518\n",
      "822 真値: [-3.59972675 -5.77655744  6.09285319] 推定値 [4.01319344 4.72426303 8.59103229] 誤差: 12.97011118185069\n",
      "823 真値: [6.65624073 4.33592815 2.81566881] 推定値 [-0.44341377 -3.03367136  6.70127204] 誤差: 10.233088051084417\n",
      "824 真値: [ 2.9132711  -2.01697834  8.39362812] 推定値 [-0.77497588 -1.5116486   1.4034653 ] 誤差: 3.722703852651805\n",
      "825 真値: [-4.04399719  1.55274689  6.39577515] 推定値 [-3.82579364  2.31871721  2.80002439] 誤差: 0.7964441717396671\n",
      "826 真値: [ 2.20372962 -1.93936477  5.22711869] 推定値 [ 1.53825268 -2.10599892  5.83257864] 誤差: 0.6860222347344302\n",
      "827 真値: [ 3.12634558 -5.40552112  6.54402682] 推定値 [-0.74447438 -1.82337846  3.98049214] 誤差: 5.2739921475111\n",
      "828 真値: [-2.69858051 -2.74325792  4.70117231] 推定値 [-0.20035808 -2.90740516  5.29832652] 誤差: 2.5036093225044285\n",
      "829 真値: [ 3.11161685 -4.65130839  6.36698119] 推定値 [ 3.03311515 -0.39500251  2.23647715] 誤差: 4.25702975019092\n",
      "830 真値: [-1.65750563 -0.80331971  5.67932056] 推定値 [-1.76345136 -0.73454731  5.5833322 ] 誤差: 0.12630969749052448\n",
      "831 真値: [-3.47983157  0.8125903   6.18257652] 推定値 [2.65541939 8.37608272 8.69057618] 誤差: 9.738979511185086\n",
      "832 真値: [ 2.87644517 -3.51500214  2.26694983] 推定値 [ 0.7891058  -2.35219313  5.40168749] 誤差: 2.389374487055303\n",
      "833 真値: [3.90687546 1.01394351 5.01192177] 推定値 [2.70059949 3.9152374  5.35097936] 誤差: 3.1420706554569633\n",
      "834 真値: [ 3.54265192 -1.80347954  4.42507043] 推定値 [ 1.99405847 -1.00431258 11.58368487] 誤差: 1.742644399910969\n",
      "835 真値: [0.45203918 2.89583038 7.23886395] 推定値 [4.08890306 0.65758559 2.87265397] 誤差: 4.270423707162586\n",
      "836 真値: [-2.97593801 -1.32790327  4.46444115] 推定値 [-1.55796747 -1.22004072  4.84147745] 誤差: 1.4220670820475811\n",
      "837 真値: [3.46072956 0.55714358 7.21958269] 推定値 [2.21322578 0.7297579  6.61885845] 誤差: 1.259389290339531\n",
      "838 真値: [-1.59412536 -4.11026134  6.60364516] 推定値 [ 2.65124916  2.55246993 10.94990625] 誤差: 7.900328655642457\n",
      "839 真値: [-0.06693785  1.33751053  5.28816996] 推定値 [-0.13322757  1.59846765 11.52402754] 誤差: 0.26924513963733193\n",
      "840 真値: [ 1.53449431 -2.57368652  3.67233543] 推定値 [ 1.73250038 -2.28870218  3.58390548] 誤差: 0.3470194230834512\n",
      "841 真値: [1.00093773 4.65765405 5.9113869 ] 推定値 [-0.02001971  4.47044333  6.07523674] 誤差: 1.0379797444291123\n",
      "842 真値: [-0.63984432  0.94686029  1.64360263] 推定値 [4.76080137e+00 3.98835053e-03 3.35141251e+00] 誤差: 5.482333570025283\n",
      "843 真値: [ 0.00915804 -3.71354724  2.99172387] 推定値 [ 2.88407851 -0.94931735  0.83599934] 誤差: 3.988249561812548\n",
      "844 真値: [-3.34645646  2.51784033  4.98207917] 推定値 [-1.51905474 -0.73461047  5.2619613 ] 誤差: 3.7306612361565916\n",
      "845 真値: [6.24452174 4.96543345 2.80694478] 推定値 [-0.20837707  4.01609055  5.12321327] 誤差: 6.522358082610864\n",
      "846 真値: [ 0.50098677 -2.96190723  3.37009909] 推定値 [ 3.05286501 -2.25898564  0.69080343] 誤差: 2.6469192074193137\n",
      "847 真値: [1.44731488 3.26602252 2.11669183] 推定値 [1.49471615 2.83699102 8.96757336] 誤差: 0.4316421032553743\n",
      "848 真値: [ 5.39885072 -0.67996215  7.72929973] 推定値 [ 4.7526185  -3.8161001   7.36601145] 誤差: 3.2020270572310996\n",
      "849 真値: [-3.86344389 -1.73489862  7.63484463] 推定値 [0.80815834 2.12840296 2.88644773] 誤差: 6.0620925837160495\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "850 真値: [-2.09495871  0.18791046  3.23082755] 推定値 [-0.87591256  1.73334615  3.85070667] 誤差: 1.9683609888227722\n",
      "851 真値: [-2.13941788 -2.21259619  4.03203522] 推定値 [-2.0917807  -1.70775918  3.97864434] 誤差: 0.5070795898509624\n",
      "852 真値: [-1.40752549  4.49562377  4.83124798] 推定値 [-2.03580515  0.07855605  3.26397631] 誤差: 4.461526938665176\n",
      "853 真値: [-1.15834395  0.97484224  4.5682281 ] 推定値 [-1.18199643  0.46179679  4.65323677] 誤差: 0.5135903671456802\n",
      "854 真値: [-2.33465901 -2.14233336  5.68049784] 推定値 [-1.93735492 -2.63691158 -0.52775116] 誤差: 0.6343958990490728\n",
      "855 真値: [-3.08109096  6.04974344  3.99256298] 推定値 [-3.41860968 -2.58922339  7.55032846] 誤差: 8.64555763552069\n",
      "856 真値: [2.22451024 2.76378198 2.90681766] 推定値 [2.24921406 3.13205403 8.25204403] 誤差: 0.3690996930174358\n",
      "857 真値: [-5.18853792 -1.19013406  6.3982339 ] 推定値 [-0.48631805  1.1137931   7.45870895] 誤差: 5.236310928287656\n",
      "858 真値: [3.38846556 3.52298106 4.50363817] 推定値 [ 6.25852809 -4.22584745  8.65509682] 誤差: 8.263268251117797\n",
      "859 真値: [2.14443253 4.98376863 3.66125762] 推定値 [0.6332668  1.96934148 5.21119509] 誤差: 3.372001315691437\n",
      "860 真値: [1.14331922 2.71301096 5.9185829 ] 推定値 [1.31590568 2.07730136 5.35938073] 誤差: 0.6587205602782652\n",
      "861 真値: [ 2.27909596 -0.50535806  5.32385481] 推定値 [ 1.988905   -0.67880746  5.43978912] 誤差: 0.3380761500389654\n",
      "862 真値: [-4.33707363 -3.85596688  7.02841477] 推定値 [3.04665125 4.60368317 2.7948331 ] 誤差: 11.228760935883768\n",
      "863 真値: [ 2.36197128 -4.43022551  6.01589862] 推定値 [0.14135327 4.12632695 5.613548  ] 誤差: 8.840007606745498\n",
      "864 真値: [-2.39446727  3.24916764  2.13583614] 推定値 [ 3.15434281 -2.97188937  3.85994428] 誤差: 8.336116819827344\n",
      "865 真値: [3.03626052 2.11847832 9.11184103] 推定値 [2.53975899 2.34597747 2.02463482] 誤差: 0.546140672609773\n",
      "866 真値: [ 0.25866229 -3.0800806   6.77971421] 推定値 [ 1.2018089  -1.57352192  5.6554466 ] 誤差: 1.7774263889675572\n",
      "867 真値: [ 1.42359252 -1.33015957  2.27977402] 推定値 [ 2.45729187 -2.06078221  2.44741528] 誤差: 1.2658371939149193\n",
      "868 真値: [0.88006897 4.77468179 8.79320245] 推定値 [0.74368594 5.73560072 1.67254743] 誤差: 0.9705490775172362\n",
      "869 真値: [-3.0637422  -3.51426252  5.25468385] 推定値 [-2.38676212  7.16169194  7.62831565] 誤差: 10.69739714339777\n",
      "870 真値: [0.75262012 0.92103934 4.76171251] 推定値 [1.07615482 0.85895072 4.64670864] 誤差: 0.329438458710816\n",
      "871 真値: [-1.08421764  0.73030945  2.53193806] 推定値 [-0.86737599 -0.00425608  2.32852525] 誤差: 0.76590262048604\n",
      "872 真値: [-5.12112077 -2.5325486   5.94109474] 推定値 [ 1.34598392 -0.73909766  1.30186855] 誤差: 6.711177937156964\n",
      "873 真値: [-3.3739644   2.72035816  3.39988829] 推定値 [-3.68047655  2.89283932  3.80096723] 誤差: 0.3517093293989779\n",
      "874 真値: [-3.3678536  -4.23944325  7.06972182] 推定値 [-2.93567704 -4.14551823  7.08895171] 誤差: 0.44226518404025655\n",
      "875 真値: [-5.02336171 -2.59279089  5.29793632] 推定値 [ 1.35435243 -0.23450321  6.92598297] 誤差: 6.799761643641949\n",
      "876 真値: [2.94184802 1.60316614 5.35223775] 推定値 [ 2.00876769  1.48229075 11.78683344] 誤差: 0.940877122819042\n",
      "877 真値: [-1.98579455 -0.76026312  1.73805977] 推定値 [-1.0973473  -3.28371348  1.97951029] 誤差: 2.6752832028024747\n",
      "878 真値: [-0.20602417 -2.66219859  2.98521151] 推定値 [9.77548309 1.57935213 6.89126613] 誤差: 10.845332616009099\n",
      "879 真値: [-3.97334695 -1.2293701   7.20528487] 推定値 [-0.87142129  3.36640917  2.97298045] 誤差: 5.544648765960513\n",
      "880 真値: [0.43363557 4.73869747 2.82944506] 推定値 [0.13324051 4.51354502 9.09512934] 誤差: 0.3754075436439116\n",
      "881 真値: [-0.34245676  3.97798019  6.36658282] 推定値 [-0.18961539  1.51043151  7.06159844] 誤差: 2.472277690074448\n",
      "882 真値: [1.49977747 3.28236342 5.95483308] 推定値 [-2.28324806  7.11742129  8.43295296] 誤差: 5.386924079759001\n",
      "883 真値: [-0.44952304 -3.60229344  4.96351522] 推定値 [8.87483013 6.09110469 1.40318359] 誤差: 13.45011261656895\n",
      "884 真値: [-2.23072884  3.74908945  3.38020392] 推定値 [-2.37902659  4.28120205  9.86901607] 誤差: 0.5523912015163177\n",
      "885 真値: [1.33529377 3.98925198 3.12957857] 推定値 [-4.73208533 -4.42865003  7.40143092] 誤差: 10.3766161839191\n",
      "886 真値: [1.03954934 0.36076669 4.77288215] 推定値 [1.23222239 0.71988212 4.70771933] 誤差: 0.4075374822488345\n",
      "887 真値: [-1.49539873  2.61279215  6.87612591] 推定値 [-1.33107447  3.10947431  6.82817642] 誤差: 0.5231592760205962\n",
      "888 真値: [-2.57652716  3.90499649  4.45405646] 推定値 [-2.18954153  1.48075797  3.22652633] 誤差: 2.454931836273396\n",
      "889 真値: [-2.38291145 -2.00995174  4.81487039] 推定値 [-1.05594    -0.9099808   4.69414239] 誤差: 1.723597782930839\n",
      "890 真値: [4.54770722 1.83955918 7.10166392] 推定値 [4.39611632 1.32968589 7.40022011] 誤差: 0.5319309935753078\n",
      "891 真値: [0.31889492 2.00725747 7.23748899] 推定値 [0.09041299 1.81122136 7.2426662 ] 誤差: 0.3010550613031995\n",
      "892 真値: [-4.42476083 -2.85573437  7.16324236] 推定値 [ 0.38678918 -3.49441872  1.55873947] 誤差: 4.853754338890339\n",
      "893 真値: [-2.61517472 -0.60459393  6.19090761] 推定値 [-1.97614077 -0.07520161  6.07632937] 誤差: 0.8298316816633662\n",
      "894 真値: [-2.70307638 -1.8078958   5.9964767 ] 推定値 [-1.78687966  0.18042371 -0.71227841] 誤差: 2.1892535122994703\n",
      "895 真値: [-0.37359843 -3.5211267   4.96634463] 推定値 [-0.54438754 -3.10110924  5.20800644] 誤差: 0.4534132683116774\n",
      "896 真値: [-2.93986705  3.84166165  2.75163512] 推定値 [-4.95315522  3.47181426  8.72775811] 誤差: 2.0469773640453273\n",
      "897 真値: [-3.71130864 -3.80909467  6.48454818] 推定値 [0.65402049 0.46648215 4.90762506] 誤差: 6.110372780791299\n",
      "898 真値: [-2.08546349 -2.07964228  5.74448541] 推定値 [-1.68375194  1.15300151 -1.23449405] 誤差: 3.257507953280556\n",
      "899 真値: [-1.24790068 -3.82884688  4.40924647] 推定値 [-1.7297753   7.9528662   3.37750461] 誤差: 11.79156334937898\n",
      "900 真値: [ 1.70179218 -2.54525264  6.89356685] 推定値 [ 1.82300557 -2.46361909  0.60298625] 誤差: 0.14613939941344112\n",
      "901 真値: [0.71550285 0.10908975 7.5323715 ] 推定値 [0.71875087 0.64872666 7.4112509 ] 誤差: 0.5396466887059027\n",
      "902 真値: [-3.46733102 -0.0550596   5.51640052] 推定値 [-3.79698207 -0.24959247  5.37907219] 誤差: 0.3827699717214002\n",
      "903 真値: [ 1.49640601 -4.86774917  6.69122567] 推定値 [-2.95619291 -2.64328118  6.17455227] 誤差: 4.977338145243066\n",
      "904 真値: [0.12688537 3.06996207 5.01163322] 推定値 [ 0.16524338 -0.15614661  4.30780047] 誤差: 3.22633670618464\n",
      "905 真値: [-2.15853206  4.00806535  4.32992984] 推定値 [-0.77398287  0.41083039  2.97099024] 誤差: 3.85448775166344\n",
      "906 真値: [-1.21025672  2.73639527  4.50142692] 推定値 [-1.18863597  1.9427552   4.18421863] 誤差: 0.7939345161195782\n",
      "907 真値: [ 0.45301049 -3.55629394  5.25849901] 推定値 [-4.25701615 -0.39053656  4.67813187] 誤差: 5.675065706713449\n",
      "908 真値: [2.3990056  2.56747969 3.88520391] 推定値 [-3.37928859 -0.04661533  5.09602305] 誤差: 6.342095602200641\n",
      "909 真値: [2.57510763 2.45752322 6.39593493] 推定値 [ 2.78196031 -0.95427796  6.60441172] 誤差: 3.4180660227690227\n",
      "910 真値: [ 1.78861499 -2.75902679  1.98320135] 推定値 [-1.72339443  5.38954164  6.42747945] 誤差: 8.873183065283888\n",
      "911 真値: [ 2.17772229 -5.11171253  8.44502749] 推定値 [ 1.57398579 -0.53270172  5.40660214] 誤差: 4.618640243250079\n",
      "912 真値: [-0.94979815  4.70955425  3.20610813] 推定値 [ 0.33085557 -1.85950342  2.38154234] 誤差: 6.692726846579784\n",
      "913 真値: [ 1.66928867 -2.32015658  2.97589256] 推定値 [-1.807322    3.58636885  7.45496987] 誤差: 6.853748204026509\n",
      "914 真値: [2.64508103 2.86865664 4.70520216] 推定値 [-2.95241205 -1.19721322  6.00118897] 誤差: 6.9183254081200465\n",
      "915 真値: [ 4.80998544 -4.47437323  1.00684584] 推定値 [2.30344401 1.51554928 8.75144432] 誤差: 6.493221197286457\n",
      "916 真値: [-4.67490599 -0.69028358  7.35541858] 推定値 [3.87603019 5.06813135 3.21527333] 誤差: 10.30911500576614\n",
      "917 真値: [4.15732852 4.59421673 3.00232306] 推定値 [-5.86738408  1.63398357  3.74875282] 誤差: 10.452647663483221\n",
      "918 真値: [0.30773283 6.41244906 3.68587863] 推定値 [-0.47041888 -0.52016602  5.40197456] 誤差: 6.976150225900534\n",
      "919 真値: [-3.85518436 -2.94407246  6.24185989] 推定値 [-2.41639881 -2.33623424  6.07319722] 誤差: 1.5619126666595768\n",
      "920 真値: [-0.19328747  2.22052368  1.52584496] 推定値 [-0.23303202  1.3847612   2.07155118] 誤差: 0.836706970237124\n",
      "921 真値: [-3.67765942  1.26088687  5.75670342] 推定値 [-3.18523227  1.66774194  6.423887  ] 誤差: 0.6387609366787754\n",
      "922 真値: [ 1.98813305 -2.17769707  7.22765037] 推定値 [ 2.2937835  -2.68896469  7.33742618] 誤差: 0.5956649862051417\n",
      "923 真値: [-4.64129684  2.05929477  5.42773021] 推定値 [-4.46755891  2.288185    4.97334186] 誤差: 0.28735971356847007\n",
      "924 真値: [3.7610004  2.05088564 2.81228304] 推定値 [-1.37626031  0.95303838 13.76258628] 誤差: 5.253257671889363\n",
      "925 真値: [-1.04575254 -0.49748641  4.45921126] 推定値 [-0.92596433 -0.42380526  4.55459559] 誤差: 0.14063472714353545\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "926 真値: [-4.38639587 -2.86915481  5.89159405] 推定値 [ 0.99933029 -0.70895635  7.21281039] 誤差: 5.80280136427495\n",
      "927 真値: [-1.29494903 -3.2381638   5.18360199] 推定値 [-4.7902518  -0.43555459  4.8258385 ] 誤差: 4.480151768917699\n",
      "928 真値: [-3.20139637  0.57012599  5.6164427 ] 推定値 [-3.82882997  0.48456069  5.48105145] 誤差: 0.6332411354249761\n",
      "929 真値: [ 1.15745573 -5.67314526  6.67923756] 推定値 [-1.06622683 -1.46853887  5.00150114] 誤差: 4.756414514250221\n",
      "930 真値: [ 4.69616245 -3.8626169   4.2859453 ] 推定値 [-0.36465016 -0.07510554  6.70158414] 誤差: 6.321160231887786\n",
      "931 真値: [-2.32557076  4.42843841  3.21330359] 推定値 [-0.6728074  -0.64079169  2.35149175] 誤差: 5.331859013272516\n",
      "932 真値: [1.59765425 5.27337672 3.68372821] 推定値 [-2.33184525 -2.75061499  5.69171297] 誤差: 8.93450666081665\n",
      "933 真値: [-2.48845678 -0.86189356  5.15051581] 推定値 [-2.25270785 -0.84025974  5.14184649] 誤差: 0.2367394705011492\n",
      "934 真値: [ 0.08065484 -2.59503775  7.26741165] 推定値 [-0.64578    -1.79122164  7.02767856] 誤差: 1.0834334012208477\n",
      "935 真値: [0.74921465 5.92910989 3.65169672] 推定値 [0.66855495 0.19753955 5.14841899] 誤差: 5.732137870253727\n",
      "936 真値: [-3.7277032   4.46320482  7.49242111] 推定値 [-0.84349315  1.68459216  5.68937727] 誤差: 4.004916481231415\n",
      "937 真値: [-1.46545357 -4.04825445  5.69629665] 推定値 [-2.20196334 -3.59962773  5.51843503] 誤差: 0.8623877079813674\n",
      "938 真値: [ 3.33185763 -3.60978218  4.47313958] 推定値 [ 2.12741678 -1.77750506  6.28375786] 誤差: 2.192696332158758\n",
      "939 真値: [-6.0613752   4.29693396  4.65036316] 推定値 [-1.54335069  2.38683296  2.52324371] 誤差: 4.90520451267093\n",
      "940 真値: [ 3.48649499 -0.46863961  6.99361764] 推定値 [ 4.61217163 -0.52672687  0.91832519] 誤差: 1.1271743486346442\n",
      "941 真値: [-3.43065157 -0.65189181  6.52739586] 推定値 [3.91447222 2.57727166 4.96091665] 誤差: 8.023611410105556\n",
      "942 真値: [-1.10918646 -6.35279104  7.37107019] 推定値 [-2.90856187  0.57371017  5.92264704] 誤差: 7.156407679328782\n",
      "943 真値: [1.92038009 3.95123318 6.44974375] 推定値 [1.35238195 1.75654105 7.76468505] 誤差: 2.2670014213463685\n",
      "944 真値: [0.69164691 1.99122586 5.36882337] 推定値 [0.68511845 1.43401919 5.38823348] 誤差: 0.5572449204545062\n",
      "945 真値: [-1.26505745 -0.13796737  6.70309536] 推定値 [-1.06263247 -0.74222616  6.73598536] 誤差: 0.6372633372516346\n",
      "946 真値: [ 2.79739039 -4.54659076  7.14531309] 推定値 [-4.86303508  5.12667913  4.46896273] 誤差: 12.339135658039211\n",
      "947 真値: [1.29313924 0.64993242 3.4518651 ] 推定値 [1.09223554 0.71133234 3.41095274] 誤差: 0.2100767631184423\n",
      "948 真値: [ 0.66160309 -0.44506843  4.70129769] 推定値 [ 0.38078517 -0.86207679  4.84996356] 誤差: 0.5027471295807687\n",
      "949 真値: [-3.28166102  2.30319812  7.73821227] 推定値 [-4.10686056  1.98555333  4.57060258] 誤差: 0.8842242337164329\n",
      "950 真値: [-1.08176304 -1.9357636   5.29803459] 推定値 [ 0.4859757   0.83066112 10.72730628] 誤差: 3.179765790868073\n",
      "951 真値: [4.79195421 0.15809505 3.6873596 ] 推定値 [ 1.69259556 -0.63182911  4.38316748] 誤差: 3.1984377759171063\n",
      "952 真値: [0.30275515 5.20360488 5.43518851] 推定値 [-0.69515958  3.71408505  5.90270717] 誤差: 1.792903555315008\n",
      "953 真値: [-3.2958855  -1.14548908  6.39123236] 推定値 [-1.93136127 -0.86291916 -0.07081329] 誤差: 1.3934748450084538\n",
      "954 真値: [ 3.30777098 -5.125969    6.91785749] 推定値 [ 0.67650247 -1.58525679  4.10560171] 誤差: 4.411373591955994\n",
      "955 真値: [-4.39403966 -3.93897178  5.44633123] 推定値 [ 1.16883363 -0.86300731  6.47627145] 誤差: 6.356659234627287\n",
      "956 真値: [-3.39597043 -3.3723468   6.86869712] 推定値 [ 3.1960757   1.05169062 11.20778027] 誤差: 7.938965878157381\n",
      "957 真値: [-3.1131145  -0.50950575  4.89072063] 推定値 [-3.49649004 -0.80068509  4.93750029] 誤差: 0.48141688178964664\n",
      "958 真値: [2.62516852 3.1181727  3.54361257] 推定値 [-2.86633369  2.79858327  7.12815492] 誤差: 5.500793938025806\n",
      "959 真値: [-5.50031346  2.51695968  6.55424353] 推定値 [-2.71932225  2.59478443  4.22071545] 誤差: 2.782079950516405\n",
      "960 真値: [-2.42543303 -1.24796308  3.66132274] 推定値 [-1.6188067  -0.10783917  3.65152669] 誤差: 1.3966132577279062\n",
      "961 真値: [ 3.26666544 -4.67157586  6.62404578] 推定値 [ 1.26472864 -4.58566747  5.6131498 ] 誤差: 2.003779232409889\n",
      "962 真値: [-5.68567552 -1.0235571   6.32795725] 推定値 [6.2204018  3.41147604 2.10409849] 誤差: 12.705282211697252\n",
      "963 真値: [-5.3069762   0.94200521  5.22554527] 推定値 [-1.41141891  5.72015727  3.00937761] 誤差: 6.1649090550711225\n",
      "964 真値: [ 3.53926218 -3.54487961  3.25787495] 推定値 [ 1.20913087 -1.42021839  5.61525168] 誤差: 3.1533628438749903\n",
      "965 真値: [4.30941221 1.54483958 2.3103532 ] 推定値 [4.07126394 1.23839662 8.45860747] 誤差: 0.3881003571501409\n",
      "966 真値: [ 3.4827555  -5.44950172  6.66373552] 推定値 [ 4.9555962  -1.20160341  1.21601947] 誤差: 4.495987077768182\n",
      "967 真値: [-4.38635992  1.26391468  6.8065794 ] 推定値 [ 2.09246072 -1.04792324  8.55339032] 誤差: 6.87893243060664\n",
      "968 真値: [2.27366142 3.59950342 5.6267131 ] 推定値 [-2.74782271 -2.08192043  0.71741397] 誤差: 7.582471882665772\n",
      "969 真値: [-1.72982712  1.30683598  4.60589105] 推定値 [-1.0273759   1.83351301  4.47994432] 誤差: 0.8779672028784485\n",
      "970 真値: [ 2.09095014 -4.74616492  7.13310115] 推定値 [ 0.08500324 -2.91201532  5.43147782] 誤差: 2.718074265683055\n",
      "971 真値: [-5.79607951  5.53617556  5.35562433] 推定値 [-3.00623092  5.23002718  4.46283802] 誤差: 2.8065961486785507\n",
      "972 真値: [-5.03692405 -2.50009023  8.9286501 ] 推定値 [ 2.77894285 -1.94048517  3.7766812 ] 誤差: 7.835874758688658\n",
      "973 真値: [ 3.26005629 -3.24013766  6.86250915] 推定値 [ 0.97382011 -2.08038148  3.37949563] 誤差: 2.56357372737387\n",
      "974 真値: [-1.03040674 -3.90787919  2.41138488] 推定値 [ 3.94100427 -0.62041393  6.40461258] 誤差: 5.960063359756805\n",
      "975 真値: [4.20925537 3.11978661 4.60223553] 推定値 [-5.73625751 -0.84003694  9.71180506] 誤差: 10.704832043513454\n",
      "976 真値: [ 0.21341637 -2.85429939  3.2009894 ] 推定値 [ 1.55725108 -1.46295469  8.60263306] 誤差: 1.934355658849643\n",
      "977 真値: [ 3.10254292 -0.74874221  6.80417402] 推定値 [3.05459553 0.74281239 6.86281983] 誤差: 1.492325050858154\n",
      "978 真値: [-1.77179876  2.30397488  4.06777524] 推定値 [-1.56773736  2.19797581  4.05776514] 誤差: 0.22994968016916156\n",
      "979 真値: [-0.95886167 -1.78403329  8.09161688] 推定値 [-1.29343737 -1.79582809  8.05902247] 誤差: 0.33478353141722783\n",
      "980 真値: [0.48181669 3.27901652 5.93312353] 推定値 [0.89190783 2.25364457 6.44542052] 誤差: 1.1043379825574784\n",
      "981 真値: [-0.64139891  3.99172312  8.31512602] 推定値 [-1.37060305  3.50820188  8.13829295] 誤差: 0.8749465514974987\n",
      "982 真値: [ 0.35472682 -1.67125817  5.61564859] 推定値 [ 0.13895878 -1.67854049  5.57783924] 誤差: 0.2158909013928785\n",
      "983 真値: [2.09771993 3.52914026 7.74098035] 推定値 [0.53699523 8.18262051 8.70073131] 誤差: 4.908231854867126\n",
      "984 真値: [-2.72658441  3.64278482  7.8336472 ] 推定値 [-6.17903708  0.8739454   4.43459699] 誤差: 4.425596138841473\n",
      "985 真値: [ 3.41564553 -4.80081021  7.0206661 ] 推定値 [ 4.13005842 -2.43434963  8.86176666] 誤差: 2.4719468926104855\n",
      "986 真値: [5.05642398 4.16260828 3.22471514] 推定値 [ 0.23837046 -3.74354071  7.19139663] 誤差: 9.258554511123501\n",
      "987 真値: [ 2.7300037  -7.44305098  6.69136654] 推定値 [-3.58106762  3.2432157   5.68647448] 誤差: 12.41071781570296\n",
      "988 真値: [4.28095593 2.03387443 3.13793243] 推定値 [4.53093214 2.35558822 9.57949025] 誤差: 0.4074160915938024\n",
      "989 真値: [-1.55126053 -5.16057735  6.86301203] 推定値 [-1.25419593  0.62697991  5.38835684] 誤差: 5.795176134072556\n",
      "990 真値: [-1.70002698  2.67352588  3.88830569] 推定値 [-1.23051808  2.1773499   3.58844945] 誤差: 0.6831026298025473\n",
      "991 真値: [-2.88600497  0.3428816   6.17966303] 推定値 [-0.85281211 -7.2524873   7.79068828] 誤差: 7.862792248018778\n",
      "992 真値: [-3.37328983  0.12341511  4.60785746] 推定値 [-2.90587322  0.40801572  4.74113396] 誤差: 0.5472438121433016\n",
      "993 真値: [ 0.46177422 -1.75194109  5.00254844] 推定値 [-0.09278877 -2.01579766  5.27793155] 誤差: 0.614133852477697\n",
      "994 真値: [-4.31343922 -0.74625152  6.82615928] 推定値 [-0.81855047  1.6177797   8.43091907] 誤差: 4.2193472212264975\n",
      "995 真値: [ 0.76976102 -2.92177142  7.71469403] 推定値 [ 1.28034528 -2.26353367  7.05186649] 誤差: 0.8330505584866653\n",
      "996 真値: [0.43504108 4.22880174 2.07719567] 推定値 [0.17590507 2.08748181 8.99108744] 誤差: 2.1569428581748076\n",
      "997 真値: [0.78489153 0.66773799 8.8527489 ] 推定値 [0.85174971 0.82348676 8.96476969] 誤差: 0.16949246505195228\n",
      "998 真値: [ 2.20916639 -0.28105045  6.11825948] 推定値 [-0.23546479 -3.94502266  8.40069202] 誤差: 4.404646858691632\n",
      "999 真値: [ 4.12222704 -3.61588654  6.93624666] 推定値 [-2.30376883 -0.31612797  6.41527392] 誤差: 7.223699158012777\n"
     ]
    }
   ],
   "source": [
    "if __name__ == '__main__': ###mclglobal1exec\n",
    "    ok = 0\n",
    "    for i in range(1000):\n",
    "        actual, estm = trial(False)\n",
    "        diff = math.sqrt((actual[0]-estm[0])**2 + (actual[1]-estm[1])**2)\n",
    "        print(i, \"真値:\", actual, \"推定値\", estm, \"誤差:\", diff)\n",
    "        if diff <= 1.0:\n",
    "            ok += 1\n",
    "\n",
    "    ok"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "/* Put everything inside the global mpl namespace */\n",
       "window.mpl = {};\n",
       "\n",
       "\n",
       "mpl.get_websocket_type = function() {\n",
       "    if (typeof(WebSocket) !== 'undefined') {\n",
       "        return WebSocket;\n",
       "    } else if (typeof(MozWebSocket) !== 'undefined') {\n",
       "        return MozWebSocket;\n",
       "    } else {\n",
       "        alert('Your browser does not have WebSocket support.' +\n",
       "              'Please try Chrome, Safari or Firefox ≥ 6. ' +\n",
       "              'Firefox 4 and 5 are also supported but you ' +\n",
       "              'have to enable WebSockets in about:config.');\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n",
       "    this.id = figure_id;\n",
       "\n",
       "    this.ws = websocket;\n",
       "\n",
       "    this.supports_binary = (this.ws.binaryType != undefined);\n",
       "\n",
       "    if (!this.supports_binary) {\n",
       "        var warnings = document.getElementById(\"mpl-warnings\");\n",
       "        if (warnings) {\n",
       "            warnings.style.display = 'block';\n",
       "            warnings.textContent = (\n",
       "                \"This browser does not support binary websocket messages. \" +\n",
       "                    \"Performance may be slow.\");\n",
       "        }\n",
       "    }\n",
       "\n",
       "    this.imageObj = new Image();\n",
       "\n",
       "    this.context = undefined;\n",
       "    this.message = undefined;\n",
       "    this.canvas = undefined;\n",
       "    this.rubberband_canvas = undefined;\n",
       "    this.rubberband_context = undefined;\n",
       "    this.format_dropdown = undefined;\n",
       "\n",
       "    this.image_mode = 'full';\n",
       "\n",
       "    this.root = $('<div/>');\n",
       "    this._root_extra_style(this.root)\n",
       "    this.root.attr('style', 'display: inline-block');\n",
       "\n",
       "    $(parent_element).append(this.root);\n",
       "\n",
       "    this._init_header(this);\n",
       "    this._init_canvas(this);\n",
       "    this._init_toolbar(this);\n",
       "\n",
       "    var fig = this;\n",
       "\n",
       "    this.waiting = false;\n",
       "\n",
       "    this.ws.onopen =  function () {\n",
       "            fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
       "            fig.send_message(\"send_image_mode\", {});\n",
       "            if (mpl.ratio != 1) {\n",
       "                fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
       "            }\n",
       "            fig.send_message(\"refresh\", {});\n",
       "        }\n",
       "\n",
       "    this.imageObj.onload = function() {\n",
       "            if (fig.image_mode == 'full') {\n",
       "                // Full images could contain transparency (where diff images\n",
       "                // almost always do), so we need to clear the canvas so that\n",
       "                // there is no ghosting.\n",
       "                fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n",
       "            }\n",
       "            fig.context.drawImage(fig.imageObj, 0, 0);\n",
       "        };\n",
       "\n",
       "    this.imageObj.onunload = function() {\n",
       "        fig.ws.close();\n",
       "    }\n",
       "\n",
       "    this.ws.onmessage = this._make_on_message_function(this);\n",
       "\n",
       "    this.ondownload = ondownload;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_header = function() {\n",
       "    var titlebar = $(\n",
       "        '<div class=\"ui-dialog-titlebar ui-widget-header ui-corner-all ' +\n",
       "        'ui-helper-clearfix\"/>');\n",
       "    var titletext = $(\n",
       "        '<div class=\"ui-dialog-title\" style=\"width: 100%; ' +\n",
       "        'text-align: center; padding: 3px;\"/>');\n",
       "    titlebar.append(titletext)\n",
       "    this.root.append(titlebar);\n",
       "    this.header = titletext[0];\n",
       "}\n",
       "\n",
       "\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_canvas = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var canvas_div = $('<div/>');\n",
       "\n",
       "    canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n",
       "\n",
       "    function canvas_keyboard_event(event) {\n",
       "        return fig.key_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    canvas_div.keydown('key_press', canvas_keyboard_event);\n",
       "    canvas_div.keyup('key_release', canvas_keyboard_event);\n",
       "    this.canvas_div = canvas_div\n",
       "    this._canvas_extra_style(canvas_div)\n",
       "    this.root.append(canvas_div);\n",
       "\n",
       "    var canvas = $('<canvas/>');\n",
       "    canvas.addClass('mpl-canvas');\n",
       "    canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n",
       "\n",
       "    this.canvas = canvas[0];\n",
       "    this.context = canvas[0].getContext(\"2d\");\n",
       "\n",
       "    var backingStore = this.context.backingStorePixelRatio ||\n",
       "\tthis.context.webkitBackingStorePixelRatio ||\n",
       "\tthis.context.mozBackingStorePixelRatio ||\n",
       "\tthis.context.msBackingStorePixelRatio ||\n",
       "\tthis.context.oBackingStorePixelRatio ||\n",
       "\tthis.context.backingStorePixelRatio || 1;\n",
       "\n",
       "    mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
       "\n",
       "    var rubberband = $('<canvas/>');\n",
       "    rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
       "\n",
       "    var pass_mouse_events = true;\n",
       "\n",
       "    canvas_div.resizable({\n",
       "        start: function(event, ui) {\n",
       "            pass_mouse_events = false;\n",
       "        },\n",
       "        resize: function(event, ui) {\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "        stop: function(event, ui) {\n",
       "            pass_mouse_events = true;\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "    });\n",
       "\n",
       "    function mouse_event_fn(event) {\n",
       "        if (pass_mouse_events)\n",
       "            return fig.mouse_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    rubberband.mousedown('button_press', mouse_event_fn);\n",
       "    rubberband.mouseup('button_release', mouse_event_fn);\n",
       "    // Throttle sequential mouse events to 1 every 20ms.\n",
       "    rubberband.mousemove('motion_notify', mouse_event_fn);\n",
       "\n",
       "    rubberband.mouseenter('figure_enter', mouse_event_fn);\n",
       "    rubberband.mouseleave('figure_leave', mouse_event_fn);\n",
       "\n",
       "    canvas_div.on(\"wheel\", function (event) {\n",
       "        event = event.originalEvent;\n",
       "        event['data'] = 'scroll'\n",
       "        if (event.deltaY < 0) {\n",
       "            event.step = 1;\n",
       "        } else {\n",
       "            event.step = -1;\n",
       "        }\n",
       "        mouse_event_fn(event);\n",
       "    });\n",
       "\n",
       "    canvas_div.append(canvas);\n",
       "    canvas_div.append(rubberband);\n",
       "\n",
       "    this.rubberband = rubberband;\n",
       "    this.rubberband_canvas = rubberband[0];\n",
       "    this.rubberband_context = rubberband[0].getContext(\"2d\");\n",
       "    this.rubberband_context.strokeStyle = \"#000000\";\n",
       "\n",
       "    this._resize_canvas = function(width, height) {\n",
       "        // Keep the size of the canvas, canvas container, and rubber band\n",
       "        // canvas in synch.\n",
       "        canvas_div.css('width', width)\n",
       "        canvas_div.css('height', height)\n",
       "\n",
       "        canvas.attr('width', width * mpl.ratio);\n",
       "        canvas.attr('height', height * mpl.ratio);\n",
       "        canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
       "\n",
       "        rubberband.attr('width', width);\n",
       "        rubberband.attr('height', height);\n",
       "    }\n",
       "\n",
       "    // Set the figure to an initial 600x600px, this will subsequently be updated\n",
       "    // upon first draw.\n",
       "    this._resize_canvas(600, 600);\n",
       "\n",
       "    // Disable right mouse context menu.\n",
       "    $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n",
       "        return false;\n",
       "    });\n",
       "\n",
       "    function set_focus () {\n",
       "        canvas.focus();\n",
       "        canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    window.setTimeout(set_focus, 100);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>')\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items) {\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) {\n",
       "            // put a spacer in here.\n",
       "            continue;\n",
       "        }\n",
       "        var button = $('<button/>');\n",
       "        button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n",
       "                        'ui-button-icon-only');\n",
       "        button.attr('role', 'button');\n",
       "        button.attr('aria-disabled', 'false');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "\n",
       "        var icon_img = $('<span/>');\n",
       "        icon_img.addClass('ui-button-icon-primary ui-icon');\n",
       "        icon_img.addClass(image);\n",
       "        icon_img.addClass('ui-corner-all');\n",
       "\n",
       "        var tooltip_span = $('<span/>');\n",
       "        tooltip_span.addClass('ui-button-text');\n",
       "        tooltip_span.html(tooltip);\n",
       "\n",
       "        button.append(icon_img);\n",
       "        button.append(tooltip_span);\n",
       "\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    var fmt_picker_span = $('<span/>');\n",
       "\n",
       "    var fmt_picker = $('<select/>');\n",
       "    fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n",
       "    fmt_picker_span.append(fmt_picker);\n",
       "    nav_element.append(fmt_picker_span);\n",
       "    this.format_dropdown = fmt_picker[0];\n",
       "\n",
       "    for (var ind in mpl.extensions) {\n",
       "        var fmt = mpl.extensions[ind];\n",
       "        var option = $(\n",
       "            '<option/>', {selected: fmt === mpl.default_extension}).html(fmt);\n",
       "        fmt_picker.append(option)\n",
       "    }\n",
       "\n",
       "    // Add hover states to the ui-buttons\n",
       "    $( \".ui-button\" ).hover(\n",
       "        function() { $(this).addClass(\"ui-state-hover\");},\n",
       "        function() { $(this).removeClass(\"ui-state-hover\");}\n",
       "    );\n",
       "\n",
       "    var status_bar = $('<span class=\"mpl-message\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n",
       "    // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n",
       "    // which will in turn request a refresh of the image.\n",
       "    this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_message = function(type, properties) {\n",
       "    properties['type'] = type;\n",
       "    properties['figure_id'] = this.id;\n",
       "    this.ws.send(JSON.stringify(properties));\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_draw_message = function() {\n",
       "    if (!this.waiting) {\n",
       "        this.waiting = true;\n",
       "        this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n",
       "    }\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    var format_dropdown = fig.format_dropdown;\n",
       "    var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n",
       "    fig.ondownload(fig, format);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_resize = function(fig, msg) {\n",
       "    var size = msg['size'];\n",
       "    if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n",
       "        fig._resize_canvas(size[0], size[1]);\n",
       "        fig.send_message(\"refresh\", {});\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
       "    var x0 = msg['x0'] / mpl.ratio;\n",
       "    var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
       "    var x1 = msg['x1'] / mpl.ratio;\n",
       "    var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
       "    x0 = Math.floor(x0) + 0.5;\n",
       "    y0 = Math.floor(y0) + 0.5;\n",
       "    x1 = Math.floor(x1) + 0.5;\n",
       "    y1 = Math.floor(y1) + 0.5;\n",
       "    var min_x = Math.min(x0, x1);\n",
       "    var min_y = Math.min(y0, y1);\n",
       "    var width = Math.abs(x1 - x0);\n",
       "    var height = Math.abs(y1 - y0);\n",
       "\n",
       "    fig.rubberband_context.clearRect(\n",
       "        0, 0, fig.canvas.width, fig.canvas.height);\n",
       "\n",
       "    fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_figure_label = function(fig, msg) {\n",
       "    // Updates the figure title.\n",
       "    fig.header.textContent = msg['label'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_cursor = function(fig, msg) {\n",
       "    var cursor = msg['cursor'];\n",
       "    switch(cursor)\n",
       "    {\n",
       "    case 0:\n",
       "        cursor = 'pointer';\n",
       "        break;\n",
       "    case 1:\n",
       "        cursor = 'default';\n",
       "        break;\n",
       "    case 2:\n",
       "        cursor = 'crosshair';\n",
       "        break;\n",
       "    case 3:\n",
       "        cursor = 'move';\n",
       "        break;\n",
       "    }\n",
       "    fig.rubberband_canvas.style.cursor = cursor;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_message = function(fig, msg) {\n",
       "    fig.message.textContent = msg['message'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_draw = function(fig, msg) {\n",
       "    // Request the server to send over a new figure.\n",
       "    fig.send_draw_message();\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_image_mode = function(fig, msg) {\n",
       "    fig.image_mode = msg['mode'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Called whenever the canvas gets updated.\n",
       "    this.send_message(\"ack\", {});\n",
       "}\n",
       "\n",
       "// A function to construct a web socket function for onmessage handling.\n",
       "// Called in the figure constructor.\n",
       "mpl.figure.prototype._make_on_message_function = function(fig) {\n",
       "    return function socket_on_message(evt) {\n",
       "        if (evt.data instanceof Blob) {\n",
       "            /* FIXME: We get \"Resource interpreted as Image but\n",
       "             * transferred with MIME type text/plain:\" errors on\n",
       "             * Chrome.  But how to set the MIME type?  It doesn't seem\n",
       "             * to be part of the websocket stream */\n",
       "            evt.data.type = \"image/png\";\n",
       "\n",
       "            /* Free the memory for the previous frames */\n",
       "            if (fig.imageObj.src) {\n",
       "                (window.URL || window.webkitURL).revokeObjectURL(\n",
       "                    fig.imageObj.src);\n",
       "            }\n",
       "\n",
       "            fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n",
       "                evt.data);\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "        else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n",
       "            fig.imageObj.src = evt.data;\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        var msg = JSON.parse(evt.data);\n",
       "        var msg_type = msg['type'];\n",
       "\n",
       "        // Call the  \"handle_{type}\" callback, which takes\n",
       "        // the figure and JSON message as its only arguments.\n",
       "        try {\n",
       "            var callback = fig[\"handle_\" + msg_type];\n",
       "        } catch (e) {\n",
       "            console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        if (callback) {\n",
       "            try {\n",
       "                // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n",
       "                callback(fig, msg);\n",
       "            } catch (e) {\n",
       "                console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n",
       "            }\n",
       "        }\n",
       "    };\n",
       "}\n",
       "\n",
       "// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n",
       "mpl.findpos = function(e) {\n",
       "    //this section is from http://www.quirksmode.org/js/events_properties.html\n",
       "    var targ;\n",
       "    if (!e)\n",
       "        e = window.event;\n",
       "    if (e.target)\n",
       "        targ = e.target;\n",
       "    else if (e.srcElement)\n",
       "        targ = e.srcElement;\n",
       "    if (targ.nodeType == 3) // defeat Safari bug\n",
       "        targ = targ.parentNode;\n",
       "\n",
       "    // jQuery normalizes the pageX and pageY\n",
       "    // pageX,Y are the mouse positions relative to the document\n",
       "    // offset() returns the position of the element relative to the document\n",
       "    var x = e.pageX - $(targ).offset().left;\n",
       "    var y = e.pageY - $(targ).offset().top;\n",
       "\n",
       "    return {\"x\": x, \"y\": y};\n",
       "};\n",
       "\n",
       "/*\n",
       " * return a copy of an object with only non-object keys\n",
       " * we need this to avoid circular references\n",
       " * http://stackoverflow.com/a/24161582/3208463\n",
       " */\n",
       "function simpleKeys (original) {\n",
       "  return Object.keys(original).reduce(function (obj, key) {\n",
       "    if (typeof original[key] !== 'object')\n",
       "        obj[key] = original[key]\n",
       "    return obj;\n",
       "  }, {});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.mouse_event = function(event, name) {\n",
       "    var canvas_pos = mpl.findpos(event)\n",
       "\n",
       "    if (name === 'button_press')\n",
       "    {\n",
       "        this.canvas.focus();\n",
       "        this.canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    var x = canvas_pos.x * mpl.ratio;\n",
       "    var y = canvas_pos.y * mpl.ratio;\n",
       "\n",
       "    this.send_message(name, {x: x, y: y, button: event.button,\n",
       "                             step: event.step,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "\n",
       "    /* This prevents the web browser from automatically changing to\n",
       "     * the text insertion cursor when the button is pressed.  We want\n",
       "     * to control all of the cursor setting manually through the\n",
       "     * 'cursor' event from matplotlib */\n",
       "    event.preventDefault();\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    // Handle any extra behaviour associated with a key event\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.key_event = function(event, name) {\n",
       "\n",
       "    // Prevent repeat events\n",
       "    if (name == 'key_press')\n",
       "    {\n",
       "        if (event.which === this._key)\n",
       "            return;\n",
       "        else\n",
       "            this._key = event.which;\n",
       "    }\n",
       "    if (name == 'key_release')\n",
       "        this._key = null;\n",
       "\n",
       "    var value = '';\n",
       "    if (event.ctrlKey && event.which != 17)\n",
       "        value += \"ctrl+\";\n",
       "    if (event.altKey && event.which != 18)\n",
       "        value += \"alt+\";\n",
       "    if (event.shiftKey && event.which != 16)\n",
       "        value += \"shift+\";\n",
       "\n",
       "    value += 'k';\n",
       "    value += event.which.toString();\n",
       "\n",
       "    this._key_event_extra(event, name);\n",
       "\n",
       "    this.send_message(name, {key: value,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onclick = function(name) {\n",
       "    if (name == 'download') {\n",
       "        this.handle_save(this, null);\n",
       "    } else {\n",
       "        this.send_message(\"toolbar_button\", {name: name});\n",
       "    }\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
       "    this.message.textContent = tooltip;\n",
       "};\n",
       "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
       "\n",
       "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
       "\n",
       "mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
       "    // Create a \"websocket\"-like object which calls the given IPython comm\n",
       "    // object with the appropriate methods. Currently this is a non binary\n",
       "    // socket, so there is still some room for performance tuning.\n",
       "    var ws = {};\n",
       "\n",
       "    ws.close = function() {\n",
       "        comm.close()\n",
       "    };\n",
       "    ws.send = function(m) {\n",
       "        //console.log('sending', m);\n",
       "        comm.send(m);\n",
       "    };\n",
       "    // Register the callback with on_msg.\n",
       "    comm.on_msg(function(msg) {\n",
       "        //console.log('receiving', msg['content']['data'], msg);\n",
       "        // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
       "        ws.onmessage(msg['content']['data'])\n",
       "    });\n",
       "    return ws;\n",
       "}\n",
       "\n",
       "mpl.mpl_figure_comm = function(comm, msg) {\n",
       "    // This is the function which gets called when the mpl process\n",
       "    // starts-up an IPython Comm through the \"matplotlib\" channel.\n",
       "\n",
       "    var id = msg.content.data.id;\n",
       "    // Get hold of the div created by the display call when the Comm\n",
       "    // socket was opened in Python.\n",
       "    var element = $(\"#\" + id);\n",
       "    var ws_proxy = comm_websocket_adapter(comm)\n",
       "\n",
       "    function ondownload(figure, format) {\n",
       "        window.open(figure.imageObj.src);\n",
       "    }\n",
       "\n",
       "    var fig = new mpl.figure(id, ws_proxy,\n",
       "                           ondownload,\n",
       "                           element.get(0));\n",
       "\n",
       "    // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n",
       "    // web socket which is closed, not our websocket->open comm proxy.\n",
       "    ws_proxy.onopen();\n",
       "\n",
       "    fig.parent_element = element.get(0);\n",
       "    fig.cell_info = mpl.find_output_cell(\"<div id='\" + id + \"'></div>\");\n",
       "    if (!fig.cell_info) {\n",
       "        console.error(\"Failed to find cell for figure\", id, fig);\n",
       "        return;\n",
       "    }\n",
       "\n",
       "    var output_index = fig.cell_info[2]\n",
       "    var cell = fig.cell_info[0];\n",
       "\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.handle_close = function(fig, msg) {\n",
       "    var width = fig.canvas.width/mpl.ratio\n",
       "    fig.root.unbind('remove')\n",
       "\n",
       "    // Update the output cell to use the data from the current canvas.\n",
       "    fig.push_to_output();\n",
       "    var dataURL = fig.canvas.toDataURL();\n",
       "    // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
       "    // the notebook keyboard shortcuts fail.\n",
       "    IPython.keyboard_manager.enable()\n",
       "    $(fig.parent_element).html('<img src=\"' + dataURL + '\" width=\"' + width + '\">');\n",
       "    fig.close_ws(fig, msg);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.close_ws = function(fig, msg){\n",
       "    fig.send_message('closing', msg);\n",
       "    // fig.ws.close()\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
       "    // Turn the data on the canvas into data in the output cell.\n",
       "    var width = this.canvas.width/mpl.ratio\n",
       "    var dataURL = this.canvas.toDataURL();\n",
       "    this.cell_info[1]['text/html'] = '<img src=\"' + dataURL + '\" width=\"' + width + '\">';\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Tell IPython that the notebook contents must change.\n",
       "    IPython.notebook.set_dirty(true);\n",
       "    this.send_message(\"ack\", {});\n",
       "    var fig = this;\n",
       "    // Wait a second, then push the new image to the DOM so\n",
       "    // that it is saved nicely (might be nice to debounce this).\n",
       "    setTimeout(function () { fig.push_to_output() }, 1000);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>')\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items){\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) { continue; };\n",
       "\n",
       "        var button = $('<button class=\"btn btn-default\" href=\"#\" title=\"' + name + '\"><i class=\"fa ' + image + ' fa-lg\"></i></button>');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    // Add the status bar.\n",
       "    var status_bar = $('<span class=\"mpl-message\" style=\"text-align:right; float: right;\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "\n",
       "    // Add the close button to the window.\n",
       "    var buttongrp = $('<div class=\"btn-group inline pull-right\"></div>');\n",
       "    var button = $('<button class=\"btn btn-mini btn-primary\" href=\"#\" title=\"Stop Interaction\"><i class=\"fa fa-power-off icon-remove icon-large\"></i></button>');\n",
       "    button.click(function (evt) { fig.handle_close(fig, {}); } );\n",
       "    button.mouseover('Stop Interaction', toolbar_mouse_event);\n",
       "    buttongrp.append(button);\n",
       "    var titlebar = this.root.find($('.ui-dialog-titlebar'));\n",
       "    titlebar.prepend(buttongrp);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(el){\n",
       "    var fig = this\n",
       "    el.on(\"remove\", function(){\n",
       "\tfig.close_ws(fig, {});\n",
       "    });\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(el){\n",
       "    // this is important to make the div 'focusable\n",
       "    el.attr('tabindex', 0)\n",
       "    // reach out to IPython and tell the keyboard manager to turn it's self\n",
       "    // off when our div gets focus\n",
       "\n",
       "    // location in version 3\n",
       "    if (IPython.notebook.keyboard_manager) {\n",
       "        IPython.notebook.keyboard_manager.register_events(el);\n",
       "    }\n",
       "    else {\n",
       "        // location in version 2\n",
       "        IPython.keyboard_manager.register_events(el);\n",
       "    }\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    var manager = IPython.notebook.keyboard_manager;\n",
       "    if (!manager)\n",
       "        manager = IPython.keyboard_manager;\n",
       "\n",
       "    // Check for shift+enter\n",
       "    if (event.shiftKey && event.which == 13) {\n",
       "        this.canvas_div.blur();\n",
       "        event.shiftKey = false;\n",
       "        // Send a \"J\" for go to next cell\n",
       "        event.which = 74;\n",
       "        event.keyCode = 74;\n",
       "        manager.command_mode();\n",
       "        manager.handle_keydown(event);\n",
       "    }\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    fig.ondownload(fig, null);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.find_output_cell = function(html_output) {\n",
       "    // Return the cell and output element which can be found *uniquely* in the notebook.\n",
       "    // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n",
       "    // IPython event is triggered only after the cells have been serialised, which for\n",
       "    // our purposes (turning an active figure into a static one), is too late.\n",
       "    var cells = IPython.notebook.get_cells();\n",
       "    var ncells = cells.length;\n",
       "    for (var i=0; i<ncells; i++) {\n",
       "        var cell = cells[i];\n",
       "        if (cell.cell_type === 'code'){\n",
       "            for (var j=0; j<cell.output_area.outputs.length; j++) {\n",
       "                var data = cell.output_area.outputs[j];\n",
       "                if (data.data) {\n",
       "                    // IPython >= 3 moved mimebundle to data attribute of output\n",
       "                    data = data.data;\n",
       "                }\n",
       "                if (data['text/html'] == html_output) {\n",
       "                    return [cell, data, j];\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "}\n",
       "\n",
       "// Register the function which deals with the matplotlib target/channel.\n",
       "// The kernel may be null if the page has been refreshed.\n",
       "if (IPython.notebook.kernel != null) {\n",
       "    IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n",
       "}\n"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<img src=\"\" width=\"400\">"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "(array([-0.98172444,  0.22612727,  5.5440477 ]),\n",
       " array([-1.25712157, -0.6094106 ,  5.86977536]))"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "trial_phantom(True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "/* Put everything inside the global mpl namespace */\n",
       "window.mpl = {};\n",
       "\n",
       "\n",
       "mpl.get_websocket_type = function() {\n",
       "    if (typeof(WebSocket) !== 'undefined') {\n",
       "        return WebSocket;\n",
       "    } else if (typeof(MozWebSocket) !== 'undefined') {\n",
       "        return MozWebSocket;\n",
       "    } else {\n",
       "        alert('Your browser does not have WebSocket support.' +\n",
       "              'Please try Chrome, Safari or Firefox ≥ 6. ' +\n",
       "              'Firefox 4 and 5 are also supported but you ' +\n",
       "              'have to enable WebSockets in about:config.');\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n",
       "    this.id = figure_id;\n",
       "\n",
       "    this.ws = websocket;\n",
       "\n",
       "    this.supports_binary = (this.ws.binaryType != undefined);\n",
       "\n",
       "    if (!this.supports_binary) {\n",
       "        var warnings = document.getElementById(\"mpl-warnings\");\n",
       "        if (warnings) {\n",
       "            warnings.style.display = 'block';\n",
       "            warnings.textContent = (\n",
       "                \"This browser does not support binary websocket messages. \" +\n",
       "                    \"Performance may be slow.\");\n",
       "        }\n",
       "    }\n",
       "\n",
       "    this.imageObj = new Image();\n",
       "\n",
       "    this.context = undefined;\n",
       "    this.message = undefined;\n",
       "    this.canvas = undefined;\n",
       "    this.rubberband_canvas = undefined;\n",
       "    this.rubberband_context = undefined;\n",
       "    this.format_dropdown = undefined;\n",
       "\n",
       "    this.image_mode = 'full';\n",
       "\n",
       "    this.root = $('<div/>');\n",
       "    this._root_extra_style(this.root)\n",
       "    this.root.attr('style', 'display: inline-block');\n",
       "\n",
       "    $(parent_element).append(this.root);\n",
       "\n",
       "    this._init_header(this);\n",
       "    this._init_canvas(this);\n",
       "    this._init_toolbar(this);\n",
       "\n",
       "    var fig = this;\n",
       "\n",
       "    this.waiting = false;\n",
       "\n",
       "    this.ws.onopen =  function () {\n",
       "            fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
       "            fig.send_message(\"send_image_mode\", {});\n",
       "            if (mpl.ratio != 1) {\n",
       "                fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
       "            }\n",
       "            fig.send_message(\"refresh\", {});\n",
       "        }\n",
       "\n",
       "    this.imageObj.onload = function() {\n",
       "            if (fig.image_mode == 'full') {\n",
       "                // Full images could contain transparency (where diff images\n",
       "                // almost always do), so we need to clear the canvas so that\n",
       "                // there is no ghosting.\n",
       "                fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n",
       "            }\n",
       "            fig.context.drawImage(fig.imageObj, 0, 0);\n",
       "        };\n",
       "\n",
       "    this.imageObj.onunload = function() {\n",
       "        fig.ws.close();\n",
       "    }\n",
       "\n",
       "    this.ws.onmessage = this._make_on_message_function(this);\n",
       "\n",
       "    this.ondownload = ondownload;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_header = function() {\n",
       "    var titlebar = $(\n",
       "        '<div class=\"ui-dialog-titlebar ui-widget-header ui-corner-all ' +\n",
       "        'ui-helper-clearfix\"/>');\n",
       "    var titletext = $(\n",
       "        '<div class=\"ui-dialog-title\" style=\"width: 100%; ' +\n",
       "        'text-align: center; padding: 3px;\"/>');\n",
       "    titlebar.append(titletext)\n",
       "    this.root.append(titlebar);\n",
       "    this.header = titletext[0];\n",
       "}\n",
       "\n",
       "\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_canvas = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var canvas_div = $('<div/>');\n",
       "\n",
       "    canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n",
       "\n",
       "    function canvas_keyboard_event(event) {\n",
       "        return fig.key_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    canvas_div.keydown('key_press', canvas_keyboard_event);\n",
       "    canvas_div.keyup('key_release', canvas_keyboard_event);\n",
       "    this.canvas_div = canvas_div\n",
       "    this._canvas_extra_style(canvas_div)\n",
       "    this.root.append(canvas_div);\n",
       "\n",
       "    var canvas = $('<canvas/>');\n",
       "    canvas.addClass('mpl-canvas');\n",
       "    canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n",
       "\n",
       "    this.canvas = canvas[0];\n",
       "    this.context = canvas[0].getContext(\"2d\");\n",
       "\n",
       "    var backingStore = this.context.backingStorePixelRatio ||\n",
       "\tthis.context.webkitBackingStorePixelRatio ||\n",
       "\tthis.context.mozBackingStorePixelRatio ||\n",
       "\tthis.context.msBackingStorePixelRatio ||\n",
       "\tthis.context.oBackingStorePixelRatio ||\n",
       "\tthis.context.backingStorePixelRatio || 1;\n",
       "\n",
       "    mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
       "\n",
       "    var rubberband = $('<canvas/>');\n",
       "    rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
       "\n",
       "    var pass_mouse_events = true;\n",
       "\n",
       "    canvas_div.resizable({\n",
       "        start: function(event, ui) {\n",
       "            pass_mouse_events = false;\n",
       "        },\n",
       "        resize: function(event, ui) {\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "        stop: function(event, ui) {\n",
       "            pass_mouse_events = true;\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "    });\n",
       "\n",
       "    function mouse_event_fn(event) {\n",
       "        if (pass_mouse_events)\n",
       "            return fig.mouse_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    rubberband.mousedown('button_press', mouse_event_fn);\n",
       "    rubberband.mouseup('button_release', mouse_event_fn);\n",
       "    // Throttle sequential mouse events to 1 every 20ms.\n",
       "    rubberband.mousemove('motion_notify', mouse_event_fn);\n",
       "\n",
       "    rubberband.mouseenter('figure_enter', mouse_event_fn);\n",
       "    rubberband.mouseleave('figure_leave', mouse_event_fn);\n",
       "\n",
       "    canvas_div.on(\"wheel\", function (event) {\n",
       "        event = event.originalEvent;\n",
       "        event['data'] = 'scroll'\n",
       "        if (event.deltaY < 0) {\n",
       "            event.step = 1;\n",
       "        } else {\n",
       "            event.step = -1;\n",
       "        }\n",
       "        mouse_event_fn(event);\n",
       "    });\n",
       "\n",
       "    canvas_div.append(canvas);\n",
       "    canvas_div.append(rubberband);\n",
       "\n",
       "    this.rubberband = rubberband;\n",
       "    this.rubberband_canvas = rubberband[0];\n",
       "    this.rubberband_context = rubberband[0].getContext(\"2d\");\n",
       "    this.rubberband_context.strokeStyle = \"#000000\";\n",
       "\n",
       "    this._resize_canvas = function(width, height) {\n",
       "        // Keep the size of the canvas, canvas container, and rubber band\n",
       "        // canvas in synch.\n",
       "        canvas_div.css('width', width)\n",
       "        canvas_div.css('height', height)\n",
       "\n",
       "        canvas.attr('width', width * mpl.ratio);\n",
       "        canvas.attr('height', height * mpl.ratio);\n",
       "        canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
       "\n",
       "        rubberband.attr('width', width);\n",
       "        rubberband.attr('height', height);\n",
       "    }\n",
       "\n",
       "    // Set the figure to an initial 600x600px, this will subsequently be updated\n",
       "    // upon first draw.\n",
       "    this._resize_canvas(600, 600);\n",
       "\n",
       "    // Disable right mouse context menu.\n",
       "    $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n",
       "        return false;\n",
       "    });\n",
       "\n",
       "    function set_focus () {\n",
       "        canvas.focus();\n",
       "        canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    window.setTimeout(set_focus, 100);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>')\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items) {\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) {\n",
       "            // put a spacer in here.\n",
       "            continue;\n",
       "        }\n",
       "        var button = $('<button/>');\n",
       "        button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n",
       "                        'ui-button-icon-only');\n",
       "        button.attr('role', 'button');\n",
       "        button.attr('aria-disabled', 'false');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "\n",
       "        var icon_img = $('<span/>');\n",
       "        icon_img.addClass('ui-button-icon-primary ui-icon');\n",
       "        icon_img.addClass(image);\n",
       "        icon_img.addClass('ui-corner-all');\n",
       "\n",
       "        var tooltip_span = $('<span/>');\n",
       "        tooltip_span.addClass('ui-button-text');\n",
       "        tooltip_span.html(tooltip);\n",
       "\n",
       "        button.append(icon_img);\n",
       "        button.append(tooltip_span);\n",
       "\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    var fmt_picker_span = $('<span/>');\n",
       "\n",
       "    var fmt_picker = $('<select/>');\n",
       "    fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n",
       "    fmt_picker_span.append(fmt_picker);\n",
       "    nav_element.append(fmt_picker_span);\n",
       "    this.format_dropdown = fmt_picker[0];\n",
       "\n",
       "    for (var ind in mpl.extensions) {\n",
       "        var fmt = mpl.extensions[ind];\n",
       "        var option = $(\n",
       "            '<option/>', {selected: fmt === mpl.default_extension}).html(fmt);\n",
       "        fmt_picker.append(option)\n",
       "    }\n",
       "\n",
       "    // Add hover states to the ui-buttons\n",
       "    $( \".ui-button\" ).hover(\n",
       "        function() { $(this).addClass(\"ui-state-hover\");},\n",
       "        function() { $(this).removeClass(\"ui-state-hover\");}\n",
       "    );\n",
       "\n",
       "    var status_bar = $('<span class=\"mpl-message\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n",
       "    // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n",
       "    // which will in turn request a refresh of the image.\n",
       "    this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_message = function(type, properties) {\n",
       "    properties['type'] = type;\n",
       "    properties['figure_id'] = this.id;\n",
       "    this.ws.send(JSON.stringify(properties));\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_draw_message = function() {\n",
       "    if (!this.waiting) {\n",
       "        this.waiting = true;\n",
       "        this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n",
       "    }\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    var format_dropdown = fig.format_dropdown;\n",
       "    var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n",
       "    fig.ondownload(fig, format);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_resize = function(fig, msg) {\n",
       "    var size = msg['size'];\n",
       "    if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n",
       "        fig._resize_canvas(size[0], size[1]);\n",
       "        fig.send_message(\"refresh\", {});\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
       "    var x0 = msg['x0'] / mpl.ratio;\n",
       "    var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
       "    var x1 = msg['x1'] / mpl.ratio;\n",
       "    var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
       "    x0 = Math.floor(x0) + 0.5;\n",
       "    y0 = Math.floor(y0) + 0.5;\n",
       "    x1 = Math.floor(x1) + 0.5;\n",
       "    y1 = Math.floor(y1) + 0.5;\n",
       "    var min_x = Math.min(x0, x1);\n",
       "    var min_y = Math.min(y0, y1);\n",
       "    var width = Math.abs(x1 - x0);\n",
       "    var height = Math.abs(y1 - y0);\n",
       "\n",
       "    fig.rubberband_context.clearRect(\n",
       "        0, 0, fig.canvas.width, fig.canvas.height);\n",
       "\n",
       "    fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_figure_label = function(fig, msg) {\n",
       "    // Updates the figure title.\n",
       "    fig.header.textContent = msg['label'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_cursor = function(fig, msg) {\n",
       "    var cursor = msg['cursor'];\n",
       "    switch(cursor)\n",
       "    {\n",
       "    case 0:\n",
       "        cursor = 'pointer';\n",
       "        break;\n",
       "    case 1:\n",
       "        cursor = 'default';\n",
       "        break;\n",
       "    case 2:\n",
       "        cursor = 'crosshair';\n",
       "        break;\n",
       "    case 3:\n",
       "        cursor = 'move';\n",
       "        break;\n",
       "    }\n",
       "    fig.rubberband_canvas.style.cursor = cursor;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_message = function(fig, msg) {\n",
       "    fig.message.textContent = msg['message'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_draw = function(fig, msg) {\n",
       "    // Request the server to send over a new figure.\n",
       "    fig.send_draw_message();\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_image_mode = function(fig, msg) {\n",
       "    fig.image_mode = msg['mode'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Called whenever the canvas gets updated.\n",
       "    this.send_message(\"ack\", {});\n",
       "}\n",
       "\n",
       "// A function to construct a web socket function for onmessage handling.\n",
       "// Called in the figure constructor.\n",
       "mpl.figure.prototype._make_on_message_function = function(fig) {\n",
       "    return function socket_on_message(evt) {\n",
       "        if (evt.data instanceof Blob) {\n",
       "            /* FIXME: We get \"Resource interpreted as Image but\n",
       "             * transferred with MIME type text/plain:\" errors on\n",
       "             * Chrome.  But how to set the MIME type?  It doesn't seem\n",
       "             * to be part of the websocket stream */\n",
       "            evt.data.type = \"image/png\";\n",
       "\n",
       "            /* Free the memory for the previous frames */\n",
       "            if (fig.imageObj.src) {\n",
       "                (window.URL || window.webkitURL).revokeObjectURL(\n",
       "                    fig.imageObj.src);\n",
       "            }\n",
       "\n",
       "            fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n",
       "                evt.data);\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "        else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n",
       "            fig.imageObj.src = evt.data;\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        var msg = JSON.parse(evt.data);\n",
       "        var msg_type = msg['type'];\n",
       "\n",
       "        // Call the  \"handle_{type}\" callback, which takes\n",
       "        // the figure and JSON message as its only arguments.\n",
       "        try {\n",
       "            var callback = fig[\"handle_\" + msg_type];\n",
       "        } catch (e) {\n",
       "            console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        if (callback) {\n",
       "            try {\n",
       "                // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n",
       "                callback(fig, msg);\n",
       "            } catch (e) {\n",
       "                console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n",
       "            }\n",
       "        }\n",
       "    };\n",
       "}\n",
       "\n",
       "// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n",
       "mpl.findpos = function(e) {\n",
       "    //this section is from http://www.quirksmode.org/js/events_properties.html\n",
       "    var targ;\n",
       "    if (!e)\n",
       "        e = window.event;\n",
       "    if (e.target)\n",
       "        targ = e.target;\n",
       "    else if (e.srcElement)\n",
       "        targ = e.srcElement;\n",
       "    if (targ.nodeType == 3) // defeat Safari bug\n",
       "        targ = targ.parentNode;\n",
       "\n",
       "    // jQuery normalizes the pageX and pageY\n",
       "    // pageX,Y are the mouse positions relative to the document\n",
       "    // offset() returns the position of the element relative to the document\n",
       "    var x = e.pageX - $(targ).offset().left;\n",
       "    var y = e.pageY - $(targ).offset().top;\n",
       "\n",
       "    return {\"x\": x, \"y\": y};\n",
       "};\n",
       "\n",
       "/*\n",
       " * return a copy of an object with only non-object keys\n",
       " * we need this to avoid circular references\n",
       " * http://stackoverflow.com/a/24161582/3208463\n",
       " */\n",
       "function simpleKeys (original) {\n",
       "  return Object.keys(original).reduce(function (obj, key) {\n",
       "    if (typeof original[key] !== 'object')\n",
       "        obj[key] = original[key]\n",
       "    return obj;\n",
       "  }, {});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.mouse_event = function(event, name) {\n",
       "    var canvas_pos = mpl.findpos(event)\n",
       "\n",
       "    if (name === 'button_press')\n",
       "    {\n",
       "        this.canvas.focus();\n",
       "        this.canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    var x = canvas_pos.x * mpl.ratio;\n",
       "    var y = canvas_pos.y * mpl.ratio;\n",
       "\n",
       "    this.send_message(name, {x: x, y: y, button: event.button,\n",
       "                             step: event.step,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "\n",
       "    /* This prevents the web browser from automatically changing to\n",
       "     * the text insertion cursor when the button is pressed.  We want\n",
       "     * to control all of the cursor setting manually through the\n",
       "     * 'cursor' event from matplotlib */\n",
       "    event.preventDefault();\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    // Handle any extra behaviour associated with a key event\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.key_event = function(event, name) {\n",
       "\n",
       "    // Prevent repeat events\n",
       "    if (name == 'key_press')\n",
       "    {\n",
       "        if (event.which === this._key)\n",
       "            return;\n",
       "        else\n",
       "            this._key = event.which;\n",
       "    }\n",
       "    if (name == 'key_release')\n",
       "        this._key = null;\n",
       "\n",
       "    var value = '';\n",
       "    if (event.ctrlKey && event.which != 17)\n",
       "        value += \"ctrl+\";\n",
       "    if (event.altKey && event.which != 18)\n",
       "        value += \"alt+\";\n",
       "    if (event.shiftKey && event.which != 16)\n",
       "        value += \"shift+\";\n",
       "\n",
       "    value += 'k';\n",
       "    value += event.which.toString();\n",
       "\n",
       "    this._key_event_extra(event, name);\n",
       "\n",
       "    this.send_message(name, {key: value,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onclick = function(name) {\n",
       "    if (name == 'download') {\n",
       "        this.handle_save(this, null);\n",
       "    } else {\n",
       "        this.send_message(\"toolbar_button\", {name: name});\n",
       "    }\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
       "    this.message.textContent = tooltip;\n",
       "};\n",
       "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
       "\n",
       "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
       "\n",
       "mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
       "    // Create a \"websocket\"-like object which calls the given IPython comm\n",
       "    // object with the appropriate methods. Currently this is a non binary\n",
       "    // socket, so there is still some room for performance tuning.\n",
       "    var ws = {};\n",
       "\n",
       "    ws.close = function() {\n",
       "        comm.close()\n",
       "    };\n",
       "    ws.send = function(m) {\n",
       "        //console.log('sending', m);\n",
       "        comm.send(m);\n",
       "    };\n",
       "    // Register the callback with on_msg.\n",
       "    comm.on_msg(function(msg) {\n",
       "        //console.log('receiving', msg['content']['data'], msg);\n",
       "        // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
       "        ws.onmessage(msg['content']['data'])\n",
       "    });\n",
       "    return ws;\n",
       "}\n",
       "\n",
       "mpl.mpl_figure_comm = function(comm, msg) {\n",
       "    // This is the function which gets called when the mpl process\n",
       "    // starts-up an IPython Comm through the \"matplotlib\" channel.\n",
       "\n",
       "    var id = msg.content.data.id;\n",
       "    // Get hold of the div created by the display call when the Comm\n",
       "    // socket was opened in Python.\n",
       "    var element = $(\"#\" + id);\n",
       "    var ws_proxy = comm_websocket_adapter(comm)\n",
       "\n",
       "    function ondownload(figure, format) {\n",
       "        window.open(figure.imageObj.src);\n",
       "    }\n",
       "\n",
       "    var fig = new mpl.figure(id, ws_proxy,\n",
       "                           ondownload,\n",
       "                           element.get(0));\n",
       "\n",
       "    // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n",
       "    // web socket which is closed, not our websocket->open comm proxy.\n",
       "    ws_proxy.onopen();\n",
       "\n",
       "    fig.parent_element = element.get(0);\n",
       "    fig.cell_info = mpl.find_output_cell(\"<div id='\" + id + \"'></div>\");\n",
       "    if (!fig.cell_info) {\n",
       "        console.error(\"Failed to find cell for figure\", id, fig);\n",
       "        return;\n",
       "    }\n",
       "\n",
       "    var output_index = fig.cell_info[2]\n",
       "    var cell = fig.cell_info[0];\n",
       "\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.handle_close = function(fig, msg) {\n",
       "    var width = fig.canvas.width/mpl.ratio\n",
       "    fig.root.unbind('remove')\n",
       "\n",
       "    // Update the output cell to use the data from the current canvas.\n",
       "    fig.push_to_output();\n",
       "    var dataURL = fig.canvas.toDataURL();\n",
       "    // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
       "    // the notebook keyboard shortcuts fail.\n",
       "    IPython.keyboard_manager.enable()\n",
       "    $(fig.parent_element).html('<img src=\"' + dataURL + '\" width=\"' + width + '\">');\n",
       "    fig.close_ws(fig, msg);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.close_ws = function(fig, msg){\n",
       "    fig.send_message('closing', msg);\n",
       "    // fig.ws.close()\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
       "    // Turn the data on the canvas into data in the output cell.\n",
       "    var width = this.canvas.width/mpl.ratio\n",
       "    var dataURL = this.canvas.toDataURL();\n",
       "    this.cell_info[1]['text/html'] = '<img src=\"' + dataURL + '\" width=\"' + width + '\">';\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Tell IPython that the notebook contents must change.\n",
       "    IPython.notebook.set_dirty(true);\n",
       "    this.send_message(\"ack\", {});\n",
       "    var fig = this;\n",
       "    // Wait a second, then push the new image to the DOM so\n",
       "    // that it is saved nicely (might be nice to debounce this).\n",
       "    setTimeout(function () { fig.push_to_output() }, 1000);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>')\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items){\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) { continue; };\n",
       "\n",
       "        var button = $('<button class=\"btn btn-default\" href=\"#\" title=\"' + name + '\"><i class=\"fa ' + image + ' fa-lg\"></i></button>');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    // Add the status bar.\n",
       "    var status_bar = $('<span class=\"mpl-message\" style=\"text-align:right; float: right;\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "\n",
       "    // Add the close button to the window.\n",
       "    var buttongrp = $('<div class=\"btn-group inline pull-right\"></div>');\n",
       "    var button = $('<button class=\"btn btn-mini btn-primary\" href=\"#\" title=\"Stop Interaction\"><i class=\"fa fa-power-off icon-remove icon-large\"></i></button>');\n",
       "    button.click(function (evt) { fig.handle_close(fig, {}); } );\n",
       "    button.mouseover('Stop Interaction', toolbar_mouse_event);\n",
       "    buttongrp.append(button);\n",
       "    var titlebar = this.root.find($('.ui-dialog-titlebar'));\n",
       "    titlebar.prepend(buttongrp);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(el){\n",
       "    var fig = this\n",
       "    el.on(\"remove\", function(){\n",
       "\tfig.close_ws(fig, {});\n",
       "    });\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(el){\n",
       "    // this is important to make the div 'focusable\n",
       "    el.attr('tabindex', 0)\n",
       "    // reach out to IPython and tell the keyboard manager to turn it's self\n",
       "    // off when our div gets focus\n",
       "\n",
       "    // location in version 3\n",
       "    if (IPython.notebook.keyboard_manager) {\n",
       "        IPython.notebook.keyboard_manager.register_events(el);\n",
       "    }\n",
       "    else {\n",
       "        // location in version 2\n",
       "        IPython.keyboard_manager.register_events(el);\n",
       "    }\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    var manager = IPython.notebook.keyboard_manager;\n",
       "    if (!manager)\n",
       "        manager = IPython.keyboard_manager;\n",
       "\n",
       "    // Check for shift+enter\n",
       "    if (event.shiftKey && event.which == 13) {\n",
       "        this.canvas_div.blur();\n",
       "        event.shiftKey = false;\n",
       "        // Send a \"J\" for go to next cell\n",
       "        event.which = 74;\n",
       "        event.keyCode = 74;\n",
       "        manager.command_mode();\n",
       "        manager.handle_keydown(event);\n",
       "    }\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    fig.ondownload(fig, null);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.find_output_cell = function(html_output) {\n",
       "    // Return the cell and output element which can be found *uniquely* in the notebook.\n",
       "    // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n",
       "    // IPython event is triggered only after the cells have been serialised, which for\n",
       "    // our purposes (turning an active figure into a static one), is too late.\n",
       "    var cells = IPython.notebook.get_cells();\n",
       "    var ncells = cells.length;\n",
       "    for (var i=0; i<ncells; i++) {\n",
       "        var cell = cells[i];\n",
       "        if (cell.cell_type === 'code'){\n",
       "            for (var j=0; j<cell.output_area.outputs.length; j++) {\n",
       "                var data = cell.output_area.outputs[j];\n",
       "                if (data.data) {\n",
       "                    // IPython >= 3 moved mimebundle to data attribute of output\n",
       "                    data = data.data;\n",
       "                }\n",
       "                if (data['text/html'] == html_output) {\n",
       "                    return [cell, data, j];\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "}\n",
       "\n",
       "// Register the function which deals with the matplotlib target/channel.\n",
       "// The kernel may be null if the page has been refreshed.\n",
       "if (IPython.notebook.kernel != null) {\n",
       "    IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n",
       "}\n"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<img src=\"\" width=\"400\">"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "(array([1.95664345, 0.83891617, 9.09852747]),\n",
       " array([1.18306447, 1.41944858, 2.19086712]))"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "trial(True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
